Skip to content

Instantly share code, notes, and snippets.

tomasz stryjewski stryju

Block or report user

Report or block stryju

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stryju
stryju / quicksort.js
Created Oct 6, 2015
quicksort (haskell-inspired) in es6
View quicksort.js
function quicksort([ x, ...xs ]) {
if (!arguments[0].length) return [];
return [ ...xs.filter( y => y <= x ), x, ...xs.filter( y => y > x ) ];
}
@stryju
stryju / 01.es6
Last active Aug 29, 2015
preferred state $http resolution
View 01.es6
const state = {
resolve : {
foo : ( $http ) => $http.get( '/foo' )
},
controller : Controller
}
class Controller {
constructor( foo ) {
this.foo = foo.data;
@stryju
stryju / Makefile
Last active Aug 29, 2015
material design icons SVG <defs> sprite generator
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>'
@stryju
stryju / _intro.md
Last active Aug 29, 2015
something something **es6**
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 );
}
}
@stryju
stryju / require-config.js
Created Jan 30, 2015
requirejs config shared between app and optimizer
View require-config.js
( function( requirejs ) {
'use strict';
requirejs.config({
// ... config goes here
});
})( typeof exports === 'object' ? {
config : function ( cfg ) {
'use strict';
@stryju
stryju / Readme.md
Last active Aug 29, 2015
check if current function is a controller for current active state
View Readme.md

ui.router's $state decorator

adding $state.controlledBy( controller[, state_name ]) function.

how could this be useful

well, if you want to see if the current state is the "last valid state", that's not a parent of currently active state.

You can’t perform that action at this time.