Skip to content

Instantly share code, notes, and snippets.

View mulder's full-sized avatar

Nicholas Mulder mulder

  • Wealthsimple
  • Waterloo, Ontario
View GitHub Profile
@trydionel
trydionel / backbone.rails.js
Created November 28, 2010 16:47
Makes Backbone.js play nicely with default Rails setup
//
// Backbone.Rails.js
//
// Makes Backbone.js play nicely with the default Rails setup, i.e.,
// no need to set
// ActiveRecord::Base.include_root_in_json = false
// and build all of your models directly from `params` rather than
// `params[:model]`.
//
// Load this file after backbone.js and before your application JS.
@ryanb
ryanb / favorite_gems.md
Created March 4, 2011 17:31
A list of my favorite gems for various tasks.
@mulder
mulder / newrelic.yml
Created July 7, 2011 13:44
Ruby/Rails Profiling with Perftools and Newrelic [theScore]
gem 'perftools.
gem 'rack-perftools_profiler'
require 'rack/perftools_profiler'
config.middleware.use ::Rack::PerftoolsProfiler, :default_printer => 'text', :mode => :cputime # cputime or walltime
class Streamer
def initialize(records, &block)
@block = nil
@records = records
@record_block = block
end
def write(bytes)
@block.call bytes
bytes.bytesize
@mislav
mislav / aprompt.png
Last active February 11, 2024 06:40
My zsh prompt. No oh-my-zsh needed
aprompt.png
@mrrooijen
mrrooijen / .gitignore
Created February 1, 2012 18:04
MiddleMan on Heroku configuration.
.DS_Store
*.swp
*.swo
Gemfile.lock
@mperham
mperham / convert.rake
Created March 15, 2012 17:44
Ruby script to update MySQL from Latin1 to UTF8 without data conversion
desc "convert a latin1 database with utf8 data into proper utf8"
task :convert_to_utf8 => :environment do
puts Time.now
dryrun = ENV['DOIT'] != '1'
conn = ActiveRecord::Base.connection
if dryrun
def conn.run_sql(sql)
puts(sql)
end
else
@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'
@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 / 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