Skip to content

Instantly share code, notes, and snippets.

Avatar

tomasz stryjewski stryju

View GitHub Profile
@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.

@stryju
stryju / require-define.sublime-snippet
Last active Aug 29, 2015
require angular sublime snippets
View require-define.sublime-snippet
<snippet>
<content><![CDATA[
/* global define */
define( function ( require, exports, module ) {
'use strict';
$1
});
]]></content>
@stryju
stryju / SassMeister-input.scss
Created Oct 17, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
$foo : null;
$bar : false;
.test {
@if not $foo {
@stryju
stryju / gulpfile.js
Last active Aug 29, 2015
sample partials
View gulpfile.js
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)
View 0_question.js
angular.module( 'foo', [] )
.service( 'Foo', service )
.directive( 'foo', directive );
function service() { /* ... */ }
function directive() {
return {
controller : controller,
controllerAs : 'fooCtrl',
@stryju
stryju / index.html
Last active Aug 29, 2015
d3 transition on nested groups
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>d3 transition on nested groups</title>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var width = 960;
@stryju
stryju / svg-size.js
Last active Aug 29, 2015
get inline SVG size in Firefox (AMD way)
View svg-size.js
/* global
define: false
*/
define( function ( ) {
'use strict';
function px( cs, prop ) {
return parseInt( cs.getPropertyValue( prop ) || 0, 10 );
}
View notes-performance.json
[
{
"note" : "note 1"
},
{
"note" : "note 2"
}
]
View scrollfix.js
var scrollPromise;
function scrollFix ( $window, $timeout, $delegate ) {
function smoothScroll() {
var y = $window.scrollY;
if ( y < 5 ) {
$window.scrollTo( 0, 0 );
@stryju
stryju / package.json
Created Jan 17, 2014
use nodemon for watching local changes and restarting your server with simple `npm start`
View package.json
{
"scripts": {
"start": "nodemon -w . index.js"
},
"dependencies": {
"nodemon": "~1.0.9"
}
}