made with esnextbin
View useFPS.js
function useFPS() { | |
const [fps, setFPS] = useState(0); | |
useEffect(() => { | |
let then = performance.now(); | |
let frames = 0; | |
let req; | |
(function loop(now) { | |
req = window.requestAnimationFrame(loop); |
View esnextbin.md
made with esnextbin
View quicksort.js
function quicksort([ x, ...xs ]) { | |
if (!arguments[0].length) return []; | |
return [ ...xs.filter( y => y <= x ), x, ...xs.filter( y => y > x ) ]; | |
} |
View 01.es6
const state = { | |
resolve : { | |
foo : ( $http ) => $http.get( '/foo' ) | |
}, | |
controller : Controller | |
} | |
class Controller { | |
constructor( foo ) { | |
this.foo = foo.data; |
View Makefile
OUTPUT = sprites/svg-defs-sprite | |
reverse = $(2) $(1) | |
id = $(shell basename $(1) | sed 's/^ic_//;s/_24px\.svg$$//;s/_/-/g' ) | |
extract = $$(cat $(1) | egrep -o $(2) | tr '\n' ' ' | sed "s/id=\"/id=\"$(call id,$(1))-/g") | |
src := $(wildcard */svg/production) | |
dest := $(patsubst %/svg/production,$(OUTPUT)/%.svg,$(src)) | |
svg_start := '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs>' |
View _intro.md
something something es6
a bit cleaned up version of my "slides"
disclaimer: this "talk" was done to show some "real life use cases" to simplify the knowledge I mainly got from Axel Rauschmayer's articles
why "destructring is a good way to go"
View package.json
{ | |
"tasks": { | |
"gulp": "gulp", | |
"dev": "gulp watch" | |
}, | |
"devDependencies": { | |
"gulp": "*" | |
} | |
} |
View foo-controller.es6
export default class FooController { | |
// @ngInject | |
constructor( $document ) { | |
console.log( $codument ); | |
} | |
} |
View require-config.js
( function( requirejs ) { | |
'use strict'; | |
requirejs.config({ | |
// ... config goes here | |
}); | |
})( typeof exports === 'object' ? { | |
config : function ( cfg ) { | |
'use strict'; |
NewerOlder