Skip to content

Instantly share code, notes, and snippets.

---
AED:
code: AED
name: Dirhams
AFN:
code: AFN
name: Afghanis
symbol: ؋
unicode_hex: 1547
ALL:
class A
def bar(*blah)
blah
end
end
class Foo < A
def bar(*)
no_commands { super }
end
@mjc
mjc / widgets.coffee
Created May 29, 2014 15:55
Sortable example for ember.js
WidgetsController = Ember.ArrayController.extend
sortProperties: ["user.firstName"]
sortAscending: true
actions:
sortBy: (sortProperties) ->
old = @get("sortProperties")
@set "sortProperties", [sortProperties]
@toggleProperty "sortAscending" if sortProperties in old
return false
@mjc
mjc / Gemfile
Last active August 29, 2015 13:57 — forked from eirc/.rvmrc
Message format benchmarks
source 'https://rubygems.org'
gem 'benchmark-ips'
gem 'json'
gem 'multi_json'
gem 'oj', platform: [:mri, :rbx]
gem 'yajl-ruby', platform: [:mri, :rbx], require: 'yajl'
gem 'jrjackson', platform: :jruby
gem 'gson', platform: :jruby
@mjc
mjc / gist:8786371
Created February 3, 2014 15:49
dtruss -- rbx -e 'puts "hi"'
dtrace: 12538 dynamic variable drops with non-empty dirty list
SYSCALL(args) = return
madvise(0x10180A000, 0x3000, 0x5) = 0 0
open("/dev/dtracehelper\0", 0x2, 0x7FFF5EF28100) = 3 0
ioctl(0x3, 0x80086804, 0x7FFF5EF28088) = 0 0
close(0x3) = 0 0
open("/dev/urandom\0", 0x20104, 0x2068) = 3 0
fstat64(0x3, 0x7FFF5EF27F30, 0x0) = 0 0
read(0x3, "\317\221\206\f\340\220T\263\364yz\276\026\001\241\212\0", 0x10) = 16 0
@mjc
mjc / config.ru
Last active January 3, 2016 06:09 — forked from ngs/config.ru
config.ru for running CakePHP apps under Pow. Includes an app/webroot rewrite and some other things from the rack-legacy example.
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
webroot = File.join(Dir.getwd,'app','webroot')
use Rack::Rewrite do
rewrite %r{/(.*)}, lambda { |match, rack_env|
File.exists?(File.join(webroot,match[1])) ? File.join('app','webroot',match[1]) : '/app/webroot/index.php/%s' % match[1]
}
@mjc
mjc / README.md
Last active February 10, 2017 17:53 — forked from erikwennerberg/README.md

Setup

Add the following gems to your Gemfile:

gem 'activeresource'
gem 'newrelic_api'

Update your bundle:

@mjc
mjc / activemerchant.gemspec.diff
Created July 30, 2013 17:11
trying to add fake extension to activemerchant to allow conditionally requiring nokogiri based on ruby version at gem install time
index 652e40c..233d9df 100644
--- a/activemerchant.gemspec
+++ b/activemerchant.gemspec
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
s.homepage = 'http://activemerchant.org/'
s.rubyforge_project = 'activemerchant'
- s.files = Dir['CHANGELOG', 'README.md', 'MIT-LICENSE', 'CONTRIBUTORS', 'gem-public_cert.pem', 'lib/**/*', 'vendor/**/*']
- s.require_path = 'lib'
+ s.files = Dir['CHANGELOG', 'README.md', 'MIT-LICENSE', 'CONTRIBUTORS', 'gem-public_cert.pem', 'lib/**/*', 'vendor/**/*', 'ext/nokogiri_conf.rb']
@mjc
mjc / gist:6029781
Created July 18, 2013 14:27
rbx error differences
class Moo
def self.moo
a = 50a
end
end
# require './moo.rb' in pry
# rbx:
# SyntaxError: /usr/local/rvm/rubies/rbx-head/runtime/melbourne.rbc:81: expecting keyword_end
# from /usr/local/rvm/rubies/rbx-head/runtime/melbourne.rbc:81:in `syntax_error'
@mjc
mjc / gist:6029403
Created July 18, 2013 13:43
fix for HTTParty in rbx 2.0 mode
diff --git a/lib/20/net/http.rb b/lib/20/net/http.rb
index fd8c802..2266617 100644
--- a/lib/20/net/http.rb
+++ b/lib/20/net/http.rb
@@ -321,7 +321,7 @@ module Net #:nodoc:
# HTTPResetContent:: 205
# HTTPPartialContent:: 206
# HTTPRedirection:: 3xx
- # HTTPMultipleChoice:: 300
+ # HTTPMultipleChoices:: 300