Skip to content

Instantly share code, notes, and snippets.

View stryju's full-sized avatar

tomasz stryjewski stryju

  • Meta
  • Kailua, HI
  • 05:15 (UTC -10:00)
View GitHub Profile
angular.module( 'foo', [] )
.service( 'Foo', service )
.directive( 'foo', directive );
function service() { /* ... */ }
function directive() {
return {
controller : controller,
controllerAs : 'fooCtrl',
@stryju
stryju / gulpfile.js
Last active August 29, 2015 14:07
sample partials
gulp.task( 'templates', function () {
// this is the partials.js
var wrapper = require( './partials' );
return gulp.src( 'assets/partials/**/*.html' )
.pipe( $.plumber() )
.pipe( wrapper({
// this will be added to the file path (template id)
root : '',
// this will be stripped away from the file path (template id)
@stryju
stryju / SassMeister-input.scss
Created October 17, 2014 08:25
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
$foo : null;
$bar : false;
.test {
@if not $foo {
@stryju
stryju / require-define.sublime-snippet
Last active August 29, 2015 14:13
require angular sublime snippets
<snippet>
<content><![CDATA[
/* global define */
define( function ( require, exports, module ) {
'use strict';
$1
});
]]></content>
@stryju
stryju / Readme.md
Last active August 29, 2015 14:14
check if current function is a controller for current active state

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.

@stryju
stryju / require-config.js
Created January 30, 2015 17:02
requirejs config shared between app and optimizer
( function( requirejs ) {
'use strict';
requirejs.config({
// ... config goes here
});
})( typeof exports === 'object' ? {
config : function ( cfg ) {
'use strict';
@stryju
stryju / foo-controller.es6
Created February 14, 2015 13:50
angular 1.x on es6
export default class FooController {
// @ngInject
constructor( $document ) {
console.log( $codument );
}
}
{
"tasks": {
"gulp": "gulp",
"dev": "gulp watch"
},
"devDependencies": {
"gulp": "*"
}
}
@stryju
stryju / _intro.md
Last active August 24, 2022 16:28
something something **es6**

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"

@stryju
stryju / Makefile
Last active August 29, 2015 14:22
material design icons SVG <defs> sprite generator
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>'