This file contains 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
/* | |
element{transition:height 500ms ease-out;height:10px;} | |
element.change{height:200px;} | |
<element transition-end="endTransition($event)"></element> | |
$scope.endTransition = function(e){ } | |
*/ | |
.directive('transitionEnd', function($parse){ | |
return { | |
restrict: 'A' | |
,link: function(scope,elem,attr){ |
This file contains 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
// detect if a text file, like Perl's stat(file); if(-T) ... | |
fs.open(file,'r',function(err, fd){ | |
if(err) return; | |
var len = 100; | |
var buf = new Buffer(len); | |
var re = /[.a-z0-9(){}\[\]? "':;<>?\s\n\r\t "':;#@~$%*<>.,_=+-]/ig; | |
fs.read(fd,buf,0,len,0,function(err,num,buf){ | |
if(err || num < 1) return; | |
var str = buf.toString('utf-8',0,num); | |
// do we have enough of the types of characters typical of a text file? |
This file contains 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
/* usage: isAnagram('Elvis','lives'); */ | |
function isAnagram(read,dear){ | |
return read.toLowerCase().split('').sort().join('') === dear.toLowerCase().split('').sort().join(''); | |
}; |
This file contains 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
/** | |
* @ngdoc filter | |
* @name sumArray | |
* @description | |
* return the sum of a list of values (no explicit type coercion) | |
* | |
* @example | |
expression: | |
`we have {{ [1, 2, 3] | sumArray }} items` |
This file contains 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
<script> | |
$scope.ping; | |
$scope.j = 4; | |
$scope.stuff = [3,7,1,0]; | |
$scome.time = new Date | |
</script> | |
<hr ng-init="ping=[1,2,3]" ng-bind="::once" ng-attr-j="::{{ 1 + jOnce }}" ng-repeat="a in b = (stuff | orderBy: 'toString()' ) track by $index"> | |
<time ng-attr-title="{{ time | date:'EEEE MMMM d, yyyy h:mm:ss a (\'GMT\'Z)' }}">{{time | date:'MM/dd/yy HH:mm:ss'}}</time> |
This file contains 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() { | |
'use strict'; | |
angular.module('derModule') | |
.directive('inputRange', ['$parse', function ngRangeSlider($parse) { | |
/** | |
* @ngdoc directive | |
* @name input-range | |
* @description | |
dual-control range inputs | |
* @example |
This file contains 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 diff(defaults, customs, diffs){ | |
/** | |
* @description | |
compare an object against the default returning an object with the differences | |
in the customs object separated out in the returned value | |
when there are no unique values in the customs object undefined is returned | |
* @returns | |
diff value, when no differences undefined, when an object returns object with keys and other values | |
* @example | |
usr.diff(defaults, custom); |
This file contains 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 extend( proto, template ){ | |
var prop; | |
for(prop in template){ | |
try{ | |
if( typeof(template[prop]) === 'function' ){ | |
// relay arguments, using predefined functions where possible | |
proto[ prop ] = proto[ prop ] || (function(prop){ | |
return function(){ return this._xhr[ prop ].apply(this._xhr, arguments); }; | |
})(prop); | |
continue; |
This file contains 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
.directive('paginateThis', function(paginate, $parse, $location){ | |
return { | |
restrict: 'A', | |
link: function (scope, elem, attr){ | |
function mapOnToModel(res){ | |
var p = scope.paginate | |
, _esp = JSON.stringify( res.options.query ) | |
, _sort = JSON.stringify( res.options.sort ) | |
; | |
This file contains 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
/** | |
* @ngdoc directive | |
* @name sortable | |
* @restrict A | |
* | |
* @description | |
* setup an object on the scope for handling a list: sorting, filtering, etc | |
* NOTE that track by statements must go at the end of the expression, after the orderBy statement | |
* | |
* @example |
OlderNewer