#The many »Talents« of JavaScript
[TOC]
##The many talents of JavaScript for generalizing Role Oriented Programming approaches like Traits and Mixins
###TL;DR / Summary
var fs = require('fs'); | |
var Buffer = require('buffer').Buffer; | |
var id3Reader = new (function(){ | |
// Credits to esailja // | |
var self = this; | |
function id3Size( buffer ) { | |
var integer = ( ( buffer[0] & 0x7F ) << 21 ) | | |
( ( buffer[1] & 0x7F ) << 14 ) | | |
( ( buffer[2] & 0x7F ) << 7 ) | |
// easing functions http://goo.gl/5HLl8 | |
Math.easeInOutQuad = function (t, b, c, d) { | |
t /= d/2; | |
if (t < 1) { | |
return c/2*t*t + b | |
} | |
t--; | |
return -c/2 * (t*(t-2) - 1) + b; | |
}; |
#The many »Talents« of JavaScript
[TOC]
##The many talents of JavaScript for generalizing Role Oriented Programming approaches like Traits and Mixins
###TL;DR / Summary
// ---- | |
// Sass (v3.3.4) | |
// Compass (v1.0.0.alpha.18) | |
// ---- | |
// Capitalize string | |
// -------------------------------------------------------------------------------- | |
// @param [string] $string | |
// -------------------------------------------------------------------------------- | |
// @return [string] |
In React 0.12, we're making a core change to how React.createClass(...)
and JSX works.
If you're using JSX in the typical way for all (and only) React components, then this transition will be seamless. Otherwise there are some minor breaking changes described below.
The Problem
Windows is really horrible system for developers and especially for devops. It doesn’t even have a usable terminal and shell, so working with command line is really pain in the ass. If you really don’t want to switch to any usable system (OS X, Linux, BSD…), then this guide should help you to setup somewhat reasonable environment – usable terminal, proper shell, ssh client, git and Sublime Text as a default editor for shell.
// loaction: loaders/es-preset.js | |
// This file is a combination of the following babel presets: | |
// es2015, react, stage-0. | |
// Difference is that the es2015-template-literals is taken out. Of the es2015 preset. | |
// This allows us to run relay transformations on the code afterwards (which will then transform any remaining template literals). | |
module.exports = preset({}); | |
function preset(context, opts) { | |
var moduleTypes = ["commonjs", "amd", "umd", "systemjs"]; | |
var loose = false; |
// You can imagine some shorthand for generating this given a component and | |
// a Relay query. | |
import React from 'react'; | |
import getFoo from './getFoo'; | |
import lazyComponent from './lazyComponent'; | |
export default function fooEntrypoint({ fooId }) { | |
const Component = lazyComponent(import('Foo')); |