Instantly share code, notes, and snippets.

View .zshrc
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
View jerky.js
function each(ar, cb){
for(var i = 0, l = ar.length; i < l; i++){
cb.call(ar[i], i, ar);
}
}
function jerkify(obj, methods, thres){
each(methods, function(meth){
var orig = obj.prototype[meth];
orig && obj.prototype[meth] = function(){
View attachpoint.js
function attachpoint(selector){
return function(){
return this.$(selector);
}
}
// eg:
declare(WidgetBase, {
$: function(selector){
return query(selector, this.domNode);
View _MustacheTemplated.js
define([
"dojo",
"dijit",
"dijit/_Templated"
], function(dojo,dijit,_Templated){
/*
mustache.js — Logic-less templates in JavaScript
See http://mustache.github.com/ for more info.
View sorter.html
<!DOCTYPE html>
<html>
<head>
<script>
var list = [0, -1, 1, -1, 0, null, 1];
var sorter = function(direction){
// returns a sort function which treats `null` as a special case, either 'always higher' (1)
// or 'always lower' (-1)
View checkwriting.js
function zero(n){
n = n.length == 1 ? n + "0" : n;
return +n;
}
function dollarsToHex(total){
var parts = total.toString(10).split(".");
return parts.map(function(part){
return zero(part).toString(16);
View magic.js
define(["dojo"], function(dojo){
return function(node, command, args){
// summary: a magic function
// example:
// magic("foo", "byId");
// example:
// magic(widget, "connect", "onClick", function(e){ })
// example:
// magic("bar", "style", { color: "red" });
View str.js
String.prototype.repr = function(n){
return Array(n + 1).join(this);
}
String.prototype.lpad = function(/* Int */ length, /* String */ pad){
// summary: left pad this string to become `length` using an optional `pad` character
return (pad || " ").repr(length - this.length) + this;
}
String.prototype.rpad = function(length, pad){
View warnings.txt
Making output directory...
source/dojox/html/metrics.rst:5: ERROR: The API Could not be fetched for dojox.html.metrics
[]
source/dojox/html/styles.rst:5: ERROR: The API Could not be fetched for dojox.html.styles
[]
source/dojox/rpc/JsonRPC.rst:5: ERROR: The API Could not be fetched for dojox.rpc.JsonRPC
[]
View handlebars.js
dojo.provide("dbp._Handlebars");
dojo.require("dijit._TemplatedMixin");
(function(d) {
// lib/handlebars/parser.js
/* Jison generated parser */
var handlebars = (function(){
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"param":27,"STRING":28,"INTEGER":29,"BOOLEAN":30,"hashSegments":31,"hashSegment":32,"ID":33,"EQUALS":34,"pathSegments":35,"SEP":36,"$accept":0,"$end":1},