Skip to content

Instantly share code, notes, and snippets.

View stryju's full-sized avatar

tomasz stryjewski stryju

  • Meta
  • Kailua, HI
  • 00:43 (UTC -10:00)
View GitHub Profile
@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-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 / 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 / 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)
angular.module( 'foo', [] )
.service( 'Foo', service )
.directive( 'foo', directive );
function service() { /* ... */ }
function directive() {
return {
controller : controller,
controllerAs : 'fooCtrl',
@stryju
stryju / index.html
Last active August 29, 2015 14:04
d3 transition on nested groups
<!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 August 29, 2015 14:02
get inline SVG size in Firefox (AMD way)
/* global
define: false
*/
define( function ( ) {
'use strict';
function px( cs, prop ) {
return parseInt( cs.getPropertyValue( prop ) || 0, 10 );
}
[
{
"note" : "note 1"
},
{
"note" : "note 2"
}
]
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 January 17, 2014 15:57
use nodemon for watching local changes and restarting your server with simple `npm start`
{
"scripts": {
"start": "nodemon -w . index.js"
},
"dependencies": {
"nodemon": "~1.0.9"
}
}