Skip to content

Instantly share code, notes, and snippets.

contra contra

Block or report user

Report or block contra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
contra / polyfill.js
Created Aug 28, 2013 — forked from remy/gist:350433
LocalStorage/SessionStorage polyfill
View polyfill.js
var isStorageAvailable = function (storage) {
if (typeof storage == 'undefined') return false;
try { // hack for safari incognito
storage.setItem("storage", "");
return true;
catch (err) {
return false;
View gist:5359196

I'm writing an app that talks to Apple to verifyReceipts. They have both a sandbox and production url that you can post to.

When communicating with Apple, if you receive a 21007 status, it means you were posting to the production url, when you should be posting to the sandbox one.

So I wrote some code to facilitate the retry logic. Here's a simplified version of my code:

var request = require('request')
  , Q = require('q')
View backbone-rivets.config.js
adapter: {
subscribe: function(obj, keypath, callback) {
if (obj instanceof Backbone.Collection) {
obj.on('add remove reset', function () {
} else {
obj.on('change:' + keypath, function (m, v) { callback(v) });
contra /
Created Jun 28, 2012 — forked from lakenen/detectanimation.js
JavaScript animated GIF detection!
isAnimatedGif = (src, cb) ->
request = new XMLHttpRequest() "GET", src, true
request.responseType = "arraybuffer"
request.addEventListener "load", ->
arr = new Uint8Array request.response
return cb false if arr[0..3] isnt [0x47,0x49,0x46,0x38]
View gist:2859361
require 'should'
http = require 'http'
Vein = require 'vein'
port = Math.floor(Math.random() * 1000) + 8000
server = new Vein http.createServer().listen port
describe 'first test', (done)->
it 'should do stuff', (done)->
server.stack = []
contra /
Created Feb 14, 2012 — forked from phated/
window.requestAnimationFrame shim
requestAnimationFrame polyfill by Erik Möller
fixes from Paul Irish and Tino Zijdel
Coffeescript and AMD by Blaine Bublitz
View gist:de3c0ea120437d8207ca
const os = require('os');
const fs = require('fs');
const path = require('path');
const execFile = require('child_process').execFile;
const tmpfile = path.join(os.tmpdir(), process.versions.v8+'.flags.json');
const exclusions = ['--help'];
module.exports = function (cb) {
fs.exists(tmpfile, function (exists) {
You can’t perform that action at this time.