Skip to content

Instantly share code, notes, and snippets.

View jmazzi's full-sized avatar

Justin Mazzi jmazzi

View GitHub Profile
@westonruter
westonruter / canPlayAudioMP3.js
Created December 10, 2009 07:13
HTML5 MP3 Audio detection
/**
* Detect if the browser can play MP3 audio using native HTML5 Audio.
* Invokes the callack function with first parameter is the boolean success
* value; if that value is false, a second error parameter is passed. This error
* is either HTMLMediaError or some other DOMException or Error object.
* Note the callback is likely to be invoked asynchronously!
* @param {function(boolean, Object|undefined)} callback
*/
function canPlayAudioMP3(callback){
try {
@jmazzi
jmazzi / ffcurl.rb
Created October 16, 2010 04:06 — forked from mnutt/ffcurl.rb
#!/usr/bin/env ruby
# ffcurl
#
# This curl that automatically uses your firefox cookies. Use it like you would normally
# use curl. Report bugs to [email protected]. Or better yet, fork it from:
#
# http://gist.github.com/393140
#
# Also for webkit/safari: http://gist.github.com/393141
@jmazzi
jmazzi / sfcurl.rb
Created October 16, 2010 04:07 — forked from mnutt/sfcurl.rb
#!/usr/bin/env ruby
# sfcurl
#
# This curl that automatically uses your safari/webkit cookies. Use it like you would
# normally use curl. Report bugs to [email protected]. Or better yet, fork it from:
#
# http://gist.github.com/gists/393141
#
# Also for firefox: http://gist.github.com/393140
@postmodern
postmodern / gix_require_benchmark.rb
Created March 10, 2011 05:04
Benchmark each require in your Ruby code.
require 'rubygems'
require 'rbtree'
class Req
attr_accessor :path, :time, :requires, :exception
def initialize(path)
@path = path
@requires = []
@time = 0
end
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

#!/bin/sh
echo "Building Titanium Mobile"
[[ ! -f ~/Code/Mobile/titanium_mobile ]] && mkdir -p ~/Code/Mobile/titanium_mobile
cd ~/Code/Mobile/titanium_mobile
git pull origin master
case "$1" in
iphone)
scons -Q iphone=1
;;
@alloy
alloy / gist:1281203
Created October 12, 2011 13:17
ActiveRecord::Relation#merge example
class Edition < ActiveRecord::Base
scope :published, where(arel_table[:published_at].not_eq(nil))
scope :generated, where(arel_table[:generated_at].not_eq(nil))
scope :available, published.generated
end
class Magazine < ActiveRecord::Base
# This is where #merge works its magic, by allowing you to merge scopes from other models.
scope :with_available_editions, includes(:editions).merge(Edition.available)
end
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@svenfuchs
svenfuchs / README.md
Created March 19, 2012 00:45
minimal activerecord standalone migrations

In your Gemfile add:

group :development, :test do
  gem 'micro_migrations', :git => '[email protected]:33e9f92c229eb808a4fa.git'
end

You might want to add something like this to the Rakefile of apps that use a gem that uses micro_migrations:

ENV['SCHEMA'] = "#{Gem.loaded_specs['your-gem-name'].full_gem_path}/db/schema.rb"

@jmazzi
jmazzi / README.md
Created March 27, 2012 19:31 — forked from svenfuchs/README.md
minimal activerecord standalone migrations

In your Gemfile add:

group :development, :test do
  gem 'micro_migrations', :git => '[email protected]:33e9f92c229eb808a4fa.git'
end

You might want to add something like this to the Rakefile of apps that use a gem that uses micro_migrations:

ENV['SCHEMA'] = "#{Gem.loaded_specs['your-gem-name'].full_gem_path}/db/schema.rb"