This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var path = require('path'); | |
var glob = require('glob'); | |
var nodesass = require('node-sass'); | |
var postcss = require('postcss'); | |
var autoprefixer = require('autoprefixer')({ browsers: ['last 2 versions', 'ie >= 9'] }); | |
var cssnano = require('cssnano'); | |
var cssmodules = require('postcss-modules')({}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.post('/some-api', {data: true}).done(function(data) { | |
//I don't need to check if settings.someAPI exists in data, _.get does that for me.. if undefined, returns null; | |
var apiDataValue = _.get(data, 'settings.someAPI', null); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ng-boolean-attr="{'data-menu': 'scope.var', 'data-stretch': 'scope.var'}" | |
angular.module('MyModule').directive('ngBooleanAttr', function() { | |
return { | |
restrict: 'A', | |
link: function(scope, element, attrs) { | |
var bat = scope.$eval(attrs.ngBooleanAttr); | |
function updateAttrVal(att, val) { | |
if(val) element.attr(att, att); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Assumes jQuery and Angular | |
$(window).resize((function() { | |
var timer; | |
return function(e) { | |
if(timer) clearTimeout(timer); | |
timer = setTimeout(function() { $rootScope.$broadcast('window-resize', e); }, 250); | |
}; | |
}())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dialog { | |
background: inherit; | |
border: 0; | |
color: inherit; | |
height: auto; | |
left: auto; | |
padding: 0; | |
position: static; | |
right: auto; | |
width: auto; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function array_walk(arr, cb) { | |
for(var i = arr.length; i > 0; i--) arr[i-1] = cb(arr[i-1]); | |
return arr; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# Coding challenge : Armstrong Numbers | |
# | |
# Write a program using any language or technique that can accept two positive | |
# integers defining a range (such as 0 and 100 for the range 0 <= x <= 100) and | |
# will print all Armstrong Numbers in that range. | |
# | |
# An Armstrong Number is fully defined at | |
# http://en.wikipedia.org/wiki/Narcissistic_number | |
# |
NewerOlder