Skip to content

Instantly share code, notes, and snippets.

var f = function() {
var v = speechSynthesis.getVoices().filter(function(v) { return v.name == 'Hysterical'; })[0],
s = ["ahahahaha", "stop it", "don't tickle me"],
t = new SpeechSynthesisUtterance(s[~~(Math.random()*s.length)]);
t.voice = v; speechSynthesis.speak(t);
};
Array.prototype.slice.call(document.querySelectorAll('a')).forEach(function(a) {
a.addEventListener('mouseover', f);
});

Useful git hooks

You can teach an old git new tricks...

How to use

  1. Save each file with the same name as in the gist (for instance, pre-commit)
  2. Make it executable: chmod +x pre-commit
  3. Put it in the .git/hooks directory of a git project
var Promise = require("bluebird");
/**
* Promised is a shim that wraps a collaborator that requires
* asynchronous initialization. Instead of having to wait for
* the initialization to finish (and do all your code that
* depends on it in a giant `.then()` call), you get an object
* you can use immediately.
*
* Every method invoked on it will simply return another promise
var async= require('async'),
cv= require('opencv'),
daoUtil= require('../dao/util'),
skybio= require('../lib/skybio'),
kairos= require('../lib/kairos'),
fre= require('../lib/fre'),
_= require('underscore'),
stats= require('stats-lite'),
fs = require('fs'),
request = require('request'),
{discover} = require "pbx/client"
amen = require "amen"
assert = require "assert"
amen.describe "One-time message pad", (context) ->
context.test "Create a message", (context) ->
api = yield discover "http://localhost:8080"
assert = require "assert"
{describe} = require "amen"
{promise} = require "when"
request = require "supertest"
app = require "../src/kick"
attempt = (fn) ->
promise (resolve, reject) ->
done = (err, result) ->
reject err if err?
@PandaWhisperer
PandaWhisperer / api.coffee
Last active August 29, 2015 14:17
Demonstration for pandastrike/pbx#18
{Builder} = require "pbx"
builder = new Builder "mediatype"
builder.define "test"
.post as: "create", creates: "test", type: "application/json"
.schema
required: ["title"]
properties:
title: type: "string"
description: type: "string"
koa = require("koa")
app = koa()
# x-response-time
app.use (next) ->
start = new Date
yield next
ms = new Date - start
@set 'X-Response-Time', ms + 'ms'
model = {
id: null, // userId, campaignId, etc.
selected: false,
disabled: false
}
function EntryView(model) {
this.model = model;
this.render()
this.$el = $( /* div we just rendered */);
@PandaWhisperer
PandaWhisperer / crash.txt
Last active August 29, 2015 14:21
Meteor crash
=> Started proxy.
=> Started MongoDB.
/Users/chris/.meteor/packages/meteor-tool/.1.1.3.ai5j4p++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:245
throw(ex);
^
TypeError: Object #<Compiler> has no method 'host'
at Compiler.visit (/Users/chris/.meteor/packages/meteor-tool/.1.1.3.ai5j4p++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/isopackets/minifiers/npm/minifiers/node_modules/css-stringify/lib/compiler.js:33:25)
at Compiler.mapVisit (/Users/chris/.meteor/packages/meteor-tool/.1.1.3.ai5j4p++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/isopackets/minifiers/npm/minifiers/node_modules/css-stringify/lib/compiler.js:45:17)
at Compiler.stylesheet (/Users/chris/.meteor/packages/meteor-tool/.1.1.3.ai5j4p++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/isopackets/minifiers/npm/minifiers/node_modules/css-stringify/lib/identity.js:43:15)