Skip to content

Instantly share code, notes, and snippets.

View bryanerayner's full-sized avatar

Bryan Rayner bryanerayner

View GitHub Profile
@bryanerayner
bryanerayner / immutableAggregateReduce.ts
Created April 10, 2017 00:25
This method returns an array of items which have changed
/**
* This runs aggregate_reduce through a sequence, in an immutable, repeatable fashion.
*
* First, elements in the sequence which were not processed, are run through evaluate().
*
* Next, elements which still have to be processed, are run through aggregateReduce().
*
* Both the aggregate, and the full sequence, are returned after execution.
*
var StreamQueue = (function () {
function StreamQueue() {
// The factory
this.nextTaskFactory = null;
// The current task
this.currentTask = null;
// Tasks which must have end() called on them.
/**
* Produces a function which uses template strings to do simple interpolation from objects.
*
* Usage:
* var makeMeKing = generateTemplateString('${name} is now the king of ${country}!');
*
* console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'}));
* // Logs 'Bryan is now the king of Scotland!'
*/
var generateTemplateString = (function(){
@bryanerayner
bryanerayner / gist:269480242eaf461632a2
Created October 25, 2014 16:00
Graph API in Typescript
/**
* Created by bryanerayner on 2014-10-18.
*/
///<reference path = "types.d.ts" />
module graphs
{
export interface INode<T>
{
_getUId:()=>string; // The string
@bryanerayner
bryanerayner / jquery.classList.js
Last active August 29, 2015 14:01 — forked from RubaXa/jquery.classList.js
Change jQuery to use the more performant classList over string concatenation methods, when ClassList is available
/**
* jQuery extension, add support `classList`.
*
* @author RubaXa <trash@rubaxa.org>, bryanerayner <bryan@bryanerayner.ca>
* @license MIT
*/
(function ($) {
var
_rspace = /\s+/
/**
Prefix - Prefixes a property with webkit, moz, or o.
Usage:
@include prefix(animation, slide 1s)
Outputs:
-webkit-animation: slide 1s;
-moz-animation: slide 1s;