Skip to content

Instantly share code, notes, and snippets.

View OliverJAsh's full-sized avatar

Oliver Joseph Ash OliverJAsh

View GitHub Profile
@felixvisee
felixvisee / example.js
Created July 4, 2013 16:00
Jasmine promise-returning spec wrapper function, example with https://github.com/slightlyoff/Promises
describe("Something", function () {
it("should promise", promising(function () {
return Promise.reject("Ouch!");
}));
});
@olivierlacan
olivierlacan / assistive_devices.md
Created June 21, 2013 07:31
How to re-enable Divvy in OS X 10.9 Mavericks when it complains about needing to "enable access to assistive devices".

At the time of this writing Divvy hasn't been updated for OS X 10.9 so it tries to direct you to the Accessibility panel of the System Preferences. Actually the assistive device settings have been moved to the Security pane as shown below:

@brian-mann
brian-mann / gist:5430655
Last active March 30, 2017 05:50
keyboard shortcuts in marionette views with mousetrap lib
_delegate = Backbone.Marionette.View::delegateEvents
_close = Backbone.Marionette.View::close
_.extend Backbone.Marionette.View::,
delegateEvents: (events) ->
_delegate.call(@, events)
@bindShortCuts()
bindShortCuts: ->
for key, method of _.result(@, "shortCuts")
@elliotf
elliotf / gist:5277447
Last active December 15, 2015 14:49
What I ended up using after smacking my face against backbone relational and backbone associations
//= require ../collections/children.js
(function($){
demo.models.Parent = Backbone.Model.extend({
initialize: function(options) {
this.children = new demo.collections.Children();
this.attributes = this.parse(this.attributes);
}
, exampleJSON: {
someAttr: 'some value'
@spion
spion / browserify-v2.jade.js
Last active December 15, 2015 04:18
browserify-jade-v2
// Example browserify transform which precompiles Jade
// templates including them in the bundle, allowing you
// to use:
// var tmpl = require('./templates/template.jade');
//
// Supports layouts and blocks
//
// requirements:
// npm install jade through
//
@adamyeats-zz
adamyeats-zz / script.js
Last active April 7, 2017 21:18
Typekit Hack
/*
This small hack loads fonts from the Typekit webfontloader (https://github.com/typekit/webfontloader)
contextually, effectively "patching" in a new font if a media query is fired.
You need to have 2 seperate kits on Typekit, one for your main fonts, and another for the fonts you want
when the media query is fired.
Improvements or suggestions welcome!
@termi
termi / crossBrowser_initKeyboardEvent.js
Last active June 13, 2023 02:01
Cross-browser initKeyboardEvent
void function() {//closure
var global = this
, _initKeyboardEvent_type = (function( e ) {
try {
e.initKeyboardEvent(
"keyup" // in DOMString typeArg
, false // in boolean canBubbleArg
, false // in boolean cancelableArg
, global // in views::AbstractView viewArg
@defunctzombie
defunctzombie / browser.md
Last active July 15, 2024 04:13
browser field spec for package.json
@davemo
davemo / api.proxy.server.js
Created November 6, 2012 21:56
A simple express.js server with a proxy that intercepts all requests with /api/ and proxies them to localhost:3000
var express = require('express'),
httpProxy = require('http-proxy'),
app = express();
var proxy = new httpProxy.RoutingProxy();
function apiProxy(host, port) {
return function(req, res, next) {
if(req.url.match(new RegExp('^\/api\/'))) {
proxy.proxyRequest(req, res, {host: host, port: port});