array_intersect(array1, array2, ..., arrayN)
The idea is simple and comes from here: http://pioupioum.fr/developpement/javascript-array-intersection.html.
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
/* | |
Infinite List View | |
creates <ul> with triggers for infinite scrolling | |
@author Kevin Jantzer, Blacktone Audio Inc. | |
@since 2012-11-06 | |
USE - listen for: |
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
angular.module('ymusica').controller('AlbumSearch', ['$scope', 'Albums', 'Artists', '$q', function($scope, albums, artists, $q) { | |
$scope.albums = []; | |
$scope.artists = []; | |
var terms = new Rx.Subject(); | |
$scope.searchMusic = terms.onNext.bind(terms); | |
terms.sample(250) |
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
var module = angular.module('racer.js', [], function ($provide) { | |
var setImmediate = window && window.setImmediate ? window.setImmediate : function (fn) { | |
setTimeout(fn, 0); | |
}; | |
var racer = require('racer'); | |
$provide.factory('racer', ['$http', '$q', '$rootScope', function ($http, $q, $rootScope) { | |
$http.get('/model').success(function (data) { | |
racer.init(data); | |
}); |
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
angular.module('MyApp', ['racer.js']). | |
config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { | |
//$locationProvider.html5Mode(true); | |
$routeProvider. | |
when('/', { templateUrl: 'partials/home.htm', controller: IndexCtrl, resolve: IndexCtrl.resolve }) | |
otherwise({redirectTo: '/'}); | |
}]); | |
function Ctrl($scope, model) { |
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
// A streaming byte oriented JSON parser. Feed it a single byte at a time and | |
// it will emit complete objects as it comes across them. Whitespace within and | |
// between objects is ignored. This means it can parse newline delimited JSON. | |
function jsonMachine(emit, next) { | |
next = next || $value; | |
return $value; | |
function $value(byte) { | |
if (!byte) return; | |
if (byte === 0x09 || byte === 0x0a || byte === 0x0d || byte === 0x20) { |
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
--EVAL 'this script' 1 some-key | |
local key = KEYS[1]; | |
local value = redis.call('GET', key); | |
local jvalue = cjson.encode(cmsgpack.unpack(value)); | |
return jvalue; |
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 keepTrying(otherArgs, promise) { | |
promise = promise||new Promise(); | |
// try doing the important thing | |
if(success) { | |
promise.resolve(result); | |
} else { | |
setTimeout(function() { | |
keepTrying(otherArgs, promise); |
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 src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script> | |
<div ng-app='app'> | |
<div ng-controller="HelloCntl"> | |
<input placeholder="Type to filter" ng-model="query"> | |
<ul> | |
<li ng-repeat="friend in friends | friendFilter:query"> |
OlderNewer