Skip to content

Instantly share code, notes, and snippets.

View myrne's full-sized avatar

Myrne Stol myrne

  • The Netherlands
View GitHub Profile

Keybase proof

I hereby claim:

  • I am myrne on github.
  • I am myrne (https://keybase.io/myrne) on keybase.
  • I have a public key ASAUr8kSHeNe9UkrQfrbRhu2hUThpfJHMYWVpw7Fe29ngQo

To claim this, I am signing this object:

@myrne
myrne / compiled.js
Created August 22, 2013 18:17 — forked from anonymous/compiled.js
Source map does work when serving these files over HTTP (or HTTPS). It doesn't work when loading them directly from disk (using `file://`).
// Generated by CommonJS Everywhere 0.9.2
(function (global) {
function require(file, parentModule) {
if ({}.hasOwnProperty.call(require.cache, file))
return require.cache[file];
var resolved = require.resolve(file);
if (!resolved)
throw new Error('Failed to resolve module ' + file);
var module$ = {
id: file,
@myrne
myrne / swift-promise-1.coffee
Last active December 18, 2015 02:18
Almost promises aplus compliant implementation. It actually passes al spec-1.1 tests as of writing (Jun 5 2013) but some things that are in the spec are not taken care of.
require "setimmediate"
module.exports = class SwiftPromise
constructor: (fn)->
@state = undefined
@finalState = undefined
@deferreds = []
@callbacks = []
resultCB = (err, result, forceError=false) =>
return unless @state is undefined
@myrne
myrne / eachSeries.coffee
Last active December 17, 2015 22:19
Old faithful.eachSeries implementation.
makePromise = require "make-promise"
module.exports = eachSeries = (values, iterator, options ={}) ->
i = 0
makePromise (cb) ->
resolver = (i) ->
(result) ->
options.handleResult? result, i
iterate()
iterate = ->
if (i >= values.length) or options.stopEarly?()
@myrne
myrne / each.coffee
Last active December 17, 2015 22:19
Old faithful.each implementation.
makePromise = require "make-promise"
module.exports = each = (values, iterator, options = {}) ->
makePromise (cb) ->
return cb null, options.getFinalValue?() unless values.length
try promises = (iterator value for value in values)
catch error then return cb error
stopped = false
numRemaining = promises.length
resolver = (index) ->
return (value) ->
@myrne
myrne / FSEventStreamCreateFlags
Created August 11, 2012 09:08
OS X FSEvent flags
kFSEventStreamCreateFlagNone = 0x00000000
kFSEventStreamCreateFlagUseCFTypes = 0x00000001
kFSEventStreamCreateFlagNoDefer = 0x00000002
kFSEventStreamCreateFlagWatchRoot = 0x00000004
kFSEventStreamCreateFlagIgnoreSelf = 0x00000008
kFSEventStreamCreateFlagFileEvents = 0x00000010
@myrne
myrne / node-trace-txmt.sh
Created April 8, 2012 13:35 — forked from x1B/node-trace-txmt.sh
Add textmate links to Node.JS stacktraces.
#! /bin/sh
sed -E -e 's_[(]?(/[^:]*/([^ ]*)):([0-9]+):([0-9]*)[)]?_[\2:\3:\4] txmt://open/?url=file://\1\&line=\3\&column=\4_g'
@myrne
myrne / Rakefile.rb
Created October 21, 2011 12:54 — forked from carlhoerberg/Rakefile.rb
How to do automatic backup with Heroku PGBackups and Heroku Cron. http://carlhoerberg.com/automatic-backup-of-heroku-database-to-s3
require 'aws/s3'
require 'heroku'
require 'heroku/command'
require 'heroku/command/auth'
require 'heroku/command/pgbackups'
task :cron do
class Heroku::Auth
def self.client
Heroku::Client.new ENV['heroku_login'], ENV['heroku_passwd']
@myrne
myrne / dropbox.rake
Created October 11, 2011 21:23 — forked from otobrglez/dropbox.rake
Rake task for moving Heroku PostgreSQL backups to Dropbox (Rails)
# By Oto Brglez - @otobrglez
# Rake task. Put in your (lib/tasks) folder of your Rails application
# Execute with "rake dropbox:backup"
# Configuration must be inside config/dropbox.yml file
namespace :dropbox do
desc "Backup production database to dropbox"
task :backup do