Sunday, November 13, 2016

"box-sizing" CSS property. Fairness somewhere near.

Bootstrap 4 has selected the initial Internet Explorer CSS box model.

Oh my goodness, there is even "International box-sizing Awareness Day" out of there. "DOWN with big content-box, BORDER-BOX 4LIVE".
It's such a boon for developers that here at CSS-Tricks we observe International Box-Sizing Awareness Day in February.

Look, Bootstrap really uses it _reboot.scss

// Reset the box-sizing
//
// Change from `box-sizing: content-box` to `border-box` so that when you add
// `padding` or `border`s to an element, the overall declared `width` does not
// change. For example, `width: 100px;` will always be `100px` despite the
// `border: 10px solid red;` and `padding: 20px;`.
//
// Heads up! This reset may cause conflicts with some third-party widgets. For
// recommendations on resolving such conflicts, see
// https://getbootstrap.com/getting-started/#third-box-sizing.
//
// Credit: https://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/

html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

And I cannot fail to mention a handy demo (it wasn’t created for Bootstrap 4, it just shows how box-sizing generally works).

Unbelievable. Were Internet Explorer developers near to front-end people those 15 years ago?



Detailed view on Box Sizing - https://css-tricks.com/box-sizing/
W3C vs IE. Time has showed))

Start CSS normalized. Bootstrap's collection

All your knowledge to start some CSS for a new project were already collected, you know.
One of the places is source code of Bootstrap.

Re-read the following before you start:

2. _reboot.scss
1. _normalize.scss

(thanks for Bootstrap 4: New & Cool Features You’ll Love)

Sunday, October 2, 2016

From DIP to DIC. Almost complete but naive.

DIP (Dependency Inversion Principle)
        IoC (Inversion of Control)
                Interface Inversion
                Flow Inversion
                etc.
                CI (Creation Inversion)
                        Factory patterns
                        Service Locater pattern
                        etc.
                        DI (Dependency Injection)
                                Constructor Injection
                                Parameters (of methods)
                                Setter Injection
                                Interface Injection (by providing a common member for injection)
                                DIC (DI Container). Old IoCC
                                        Ninject
                                        Unity
                                        Structure Map
                                        etc.

Monday, February 15, 2016

Thursday, September 10, 2015

JavaScript Revealing Prototype Pattern - Error Prone Point

The pattern has a unsafe context switching.
It can make you pain.

Look at JSFiddle
Revealing Prototype Pattern error prone point

Think twice before use it.
Revealing Module Pattern is cool (and FFE).

Friday, November 14, 2014

Asynchronous Programming Concepts (.NET related)

Async execution - It's all about responsiveness.
Old code scenarios
To use WaitHandle from a Task.
Implement the APM pattern by FromAsync methods and "Tasks Forest"
Implement the EPM pattern by TaskCompletionSource.
Asynchronous Task
means the Threadless Task.
Asynchronous Tasks may have only the next statuses:
Fault, RunToCompletion, Cancelled.
Continuation for Asynchronous Tasks
Use the TaskCompletionSource<T> class.
async await
A syntactic sugar for awful amount of work.
A compiler's underground job.
A enumeration, try, finally, using and etc.
Users SynchronizationContext implicitly.
Unwrap multiple exceptions
The await will return only the first exception from a AggregateException.
There is a useful trick to unwrap multiple exceptions.
await task.ContinueWith(
    ( ) => { },
    TaskContinuationOptions.ExecuteSynchronously
);
var results = task.Result;
Multiple await
Preventing of lost exceptions with multiple await. (await like Parallel Programming fashion)
- Use trick from the Unwrap multiple exceptions.