Skip to content

Instantly share code, notes, and snippets.

View stryju's full-sized avatar

tomasz stryjewski stryju

  • Meta
  • Kailua, HI
  • 07:22 (UTC -10:00)
View GitHub Profile
@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 / 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>'
@stryju
stryju / 01.es6
Last active August 29, 2015 14:23
preferred state $http resolution
const state = {
resolve : {
foo : ( $http ) => $http.get( '/foo' )
},
controller : Controller
}
class Controller {
constructor( foo ) {
this.foo = foo.data;
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@stryju
stryju / gist:2814801
Created May 27, 2012 15:33
add favicon to anchor tags via css
// 1st of all - enhance $.unique, so it works for normal arrays
// via http://paulirish.com/2010/duck-punching-with-jquery/
(function($){
var _old = $.unique;
$.unique = function(arr){
// do the default behavior only if we got an array of elements
if (!!arr[0].nodeType){
return _old.apply(this,arguments);
} else {
// reduce the array to contain no dupes via grep/inArray
// hey there! ;-)
(function() {
var doc = document,
body = doc.body,
atan2 = Math.atan2,
cos = Math.cos,
sin = Math.sin,
sqrt = Math.sqrt,
{
"auto_complete_commit_on_tab": false,
"bold_folder_labels": true,
"color_scheme": "Packages/User/Monokai Soda.tmTheme",
"default_line_ending": "unix",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.pyc",
function caretInception( node, index, found ){
var response = {
found : found,
index : index
};
if ( found ) {
return response;
}
;( function( $, window, document, undefined ){
"use strict";
$.fn.formObject = function( data ){
if ( data ){
this.each( function(){
// we do it only for forms
if ( ! /form/i.test( this.tagName )){
return false;
}