Skip to content

Instantly share code, notes, and snippets.

View mulder's full-sized avatar

Nicholas Mulder mulder

  • Wealthsimple
  • Waterloo, Ontario
View GitHub Profile
@mattrude
mattrude / UniFi Controller FreeNAS Install.md
Last active April 4, 2017 20:12
A simple script to install the UniFi Controller v4 on FreeNAS 9.10-STABLE. For more information see https://wiki.mattrude.com/FreeNAS/Unifi_Controller_Install
@mulder
mulder / larch.notes
Created September 11, 2014 10:48
Move email from one gmail account to another
gem install larch
larch --from imaps://imap.gmail.com --to imaps://imap.gmail.com --from-folder '[Gmail]/All Mail' --to-folder '[Gmail]/All Mail'
require 'rack/util/file'
path = ARGV.shift || Dir.pwd
run Rack::File.new(path, { 'Accept-Ranges' => 'bytes'})
require 'activesupport' # assuming this is already loaded by some dependency..
require 'json'
if defined?(ActiveSupport::JSON)
[Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].each do |klass|
klass.class_eval do
def to_json(*args)
super(args)
end
end
@mulder
mulder / ruby.rb
Created August 20, 2012 17:47 — forked from haifeng/meta.rb
i18n positions
# heavily based on Masao Mutoh's gettext String interpolation extension
# http://github.com/mutoh/gettext/blob/f6566738b981fe0952548c421042ad1e0cdfb31e/lib/gettext/core_ext/string.rb
module I18n
INTERPOLATION_PATTERN = Regexp.union(
/%%/,
/%\{(\w+)\}/, # matches placeholders like "%{foo}"
/%<(\w+)>(.*?\d*\.?\d*[bBdiouxXeEfgGcps])/ # matches placeholders like "%<foo>.d"
)
@haifeng
haifeng / meta.rb
Created August 20, 2012 17:46
i18n positions
$LOAD_PATH << './lib'
require 'i18n.rb'
class Backend < I18n::Backend::Simple
include I18n::Backend::Metadata
end
# if string.respond_to?(:translation_metadata)
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@mulder
mulder / proc_marshal.rb
Created July 23, 2012 10:23 — forked from headius/proc_marshal.rb
Jruby - seriaalize Proc
require 'jruby'
module Serialize
def self.serialize(obj)
baos = java.io.ByteArrayOutputStream.new
oos = java.io.ObjectOutputStream.new(baos)
oos.write_object(JRuby.reference(obj))
oos.close
@igrigorik
igrigorik / gist:3148848
Created July 20, 2012 05:24
Convert any YouTube video into an audio file you can listen to on the go...
# Convert any YouTube video into an audio file you can listen to on the go, using:
# http://rg3.github.com/youtube-dl/
{ ~ } > brew install ffmpeg
{ ~ } > wget https://raw.github.com/rg3/youtube-dl/2012.02.27/youtube-dl
{ ~ } > chmod u+x youtube-dl
# Pick which video format you want to download.. (use any YT video link)
{ ~ } > ./youtube-dl -s -F http://www.youtube.com/watch?v=vT1KmTQ-1Os
@mulder
mulder / Gemfile
Created April 12, 2012 11:14 — forked from mbleigh/Gemfile
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
source "https://rubygems.org"
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'handlebars_assets'
gem 'coffee-script'