(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
/* | |
* Set up your Git configuration | |
*/ | |
git config --global user.email "you@yourdomain.com" | |
git config --global user.name "Your Name" | |
git config --global core.editor "nano" |
public static class TypeExtensions | |
{ | |
/// <summary> | |
/// Determine whether a type is simple (String, Decimal, DateTime, etc) | |
/// or complex (i.e. custom class with public properties and methods). | |
/// </summary> | |
/// <see cref="http://stackoverflow.com/questions/2442534/how-to-test-if-type-is-primitive"/> | |
public static bool IsSimpleType( | |
this Type type) | |
{ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Array.prototype.selectMany = function (fn) { | |
return this.map(fn).reduce(function (x, y) { return x.concat(y); }, []); | |
}; | |
// usage | |
console.log([[1,2,3], [4,5,6]].selectMany(function (x) { return x; })); //[1,2,3,4,5,6] | |
console.log([{ a: [1,2,3] }, { a: [4,5,6] }].selectMany(function (x) { return x.a; })); |
If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.
Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.
If in doubt about what git is doing when you run these commands, just
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
Recommendations of unit types per media type:
Media | Recommended | Occasional use | Infrequent use | Not recommended |
---|---|---|---|---|
Screen | em, rem, % | px | ch, ex, vw, vh, vmin, vmax | cm, mm, in, pt, pc |
em, rem, % | cm, mm, in, pt, pc | ch, ex | px, vw, vh, vmin, vmax |
tldr; | |
DDD is primarily about modeling a Ubiquitous (= überall vertreten) Language in an Bounded Context. | |
It avoids the design of monolithic applications. | |
Use DDD when the business model complexity is high (higher than the technical aspects of the project). | |
Bounded Context - semantic contextual boundary | |
Within the boundary, each component of the software model has a specific meaning and does specific things | |
The components inside a Bounded Context are context specific and semantically motivated. | |
In the Beginning of software modeling the Bounded Context is only coceptual and is part of the Problem Space. |
test("mock implementation", () => { | |
const mock = jest.fn(() => "bar"); | |
expect(mock("foo")).toBe("bar"); | |
expect(mock).toHaveBeenCalledWith("foo"); | |
}); | |
test("also mock implementation", () => { | |
const mock = jest.fn().mockImplementation(() => "bar"); |