Skip to content

Instantly share code, notes, and snippets.

@harukizaemon
harukizaemon / gist:954738
Created May 4, 2011 04:02
Borked Psych/libyaml
require 'psych'
require 'yaml'
require 'erb'
puts "RUBY_VERSION: #{RUBY_VERSION}"
puts "YAML::VERSION: #{YAML::VERSION}"
yaml = <<-YAML
common: &common
adapter: postgresql
@harukizaemon
harukizaemon / gist:933404
Created April 21, 2011 00:25
TextMate folder pattern
!.*/(\.[^/]*|(r?spec|features)/reports|coverage|log|tmp|system|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$
JSDot: http://code.google.com/p/jsdot/
Graph Dracula: http://www.graphdracula.net/
Protovis: http://vis.stanford.edu/protovis/ex/
Rubyvis: http://rubyvis.rubyforge.org/
Infovis: http://thejit.org/
Arbor: http://arborjs.org/
BINViz: http://binviz.sourceforge.net/
NodeBox: http://nodebox.net/code/index.php/Home
Springy: https://github.com/dhotson/springy
Flare: http://flare.prefuse.org/
org/jruby/RubyKernel.java:1041:in `require': load error: spec_helper -- java.lang.NoClassDefFoundError: Could not initialize class org.jruby.javasupport.Java (LoadError)
from ~/Projects/hamster/spec/hamster/core_ext/array_spec.rb:1:in `(root)'
from org/jruby/RubyKernel.java:1066:in `load'
from ~/Projects/hamster/spec/hamster/core_ext/array_spec.rb:387:in `load_spec_files'
from org/jruby/RubyArray.java:2460:in `collect'
from ~/.rvm/gems/jruby-1.6.0.RC1/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in `load_spec_files'
from ~/.rvm/gems/jruby-1.6.0.RC1/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:18:in `run'
from ~/.rvm/gems/jruby-1.6.0.RC1/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in `run_in_process'
from ~/.rvm/gems/jruby-1.6.0.RC1/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:46:in `run'
/guides/personal
/guides/published
/guides/(personal|published)/:id/summary
/guides/(personal|published)/:id/detail
/guides/(personal|published)/:id/content
/guides/(personal|published)/:id/history
The controller behaviour is identical whether published or personal, save some authorisation checks.
ActionDispatch::ShowExceptions.rescue_responses.update(
"Query::RecordNotFound" => :not_found,
"Command::AggregateNotFound" => :not_found,
"Command::EntityNotFound" => :not_found,
"Authorisation::Error" => :not_found
)
def even?(n)
n.zero? or odd?(n - 1)
end
def odd?(n)
n.zero? or even?(n - 1)
end
/* Toggle Resize an element (if necessary) to fit its container. */
$.fn.toggleSizeToFit = function() {
var width = this.width();
var containerWidth = this.parent().width();
var dimensions;
// If bigger than container
if (width > containerWidth) {
dimensions = { width: width, height: this.height() };
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
@harukizaemon
harukizaemon / gist:667394
Created November 8, 2010 04:53
Failing traceroute to www.me.com via Telstra Bigpond
traceroute to e1235.b.akamaiedge.net (125.56.181.47), 64 hops max, 52 byte packets
1 home.gateway (192.168.1.254) 1.334 ms 0.814 ms 0.614 ms
2 172.18.112.99 (172.18.112.99) 27.929 ms 27.395 ms 28.046 ms
3 172.18.67.14 (172.18.67.14) 28.122 ms 28.568 ms 26.889 ms
4 172.18.240.161 (172.18.240.161) 31.350 ms 26.954 ms 27.582 ms
5 bundle-ether11.win18.melbourne.telstra.net (203.45.17.41) 29.567 ms 27.468 ms 27.881 ms
6 bundle-ether2.win-core1.melbourne.telstra.net (203.50.6.113) 28.174 ms 28.893 ms 28.293 ms
7 bundle-pos3.ken-core4.sydney.telstra.net (203.50.11.12) 40.284 ms 40.575 ms 42.918 ms
8 bundle-ether1.ken39.sydney.telstra.net (203.50.6.146) 46.880 ms 40.404 ms 40.733 ms
9 telstr688.lnk.telstra.net (203.45.17.18) 40.560 ms 41.077 ms 40.884 ms