Skip to content

Instantly share code, notes, and snippets.

@ream88
ream88 / gist:3074898
Created July 9, 2012 07:55
Deep nested hashes in Ruby #snippet
h = Hash.new { |h,k| h[k] = Hash.new(&h.default_proc) }
h[:a][:b][:c] = "123"
h # => {:a=>{:b=>{:c=>"123"}}}
@ream88
ream88 / gist:3074893
Created July 9, 2012 07:53
Colored diff as html #snippet
vim -d old.rb new.rb +:TOhtml +:x +:qa
@ream88
ream88 / dabblet.css
Created July 2, 2012 19:32
Anita Ammersfeld
/**
* Anita Ammersfeld
*/
a.box {
display: inline-block;
position: relative;
border-top: 1px dashed black;
border-right: 1px dashed black;
cursor: pointer;
@ream88
ream88 / gist:2415052
Created April 18, 2012 17:04
Start and stop mysql under OSX #snippet
find ~/Library/LaunchAgents/*mysql* | xargs launchctl load
find ~/Library/LaunchAgents/*mysql* | xargs launchctl unload
@ream88
ream88 / Cakefile
Created March 29, 2012 21:04
Simple Cakefile which helps you to compile coffee-script files in the order you like.
exec = require('child_process').exec
fs = require('fs')
Array::remove = (e) -> @[t..t] = [] if (t = @indexOf(e)) > -1
Array::include = (e) -> @indexOf(e) > -1
config =
# All files are compiled in the order you like into following ".js" file.
output: 'public/javascripts/app.js'
@ream88
ream88 / 0-README.md
Created March 1, 2012 11:47
Ruby-1.9.x debugger install script

Ruby-1.9.3 debugger install script

This script will install ruby-debug19 under your current Ruby 1.9.3 environment.

Requirements

  • rbenv

Installation

@ream88
ream88 / mock_verify_method.rb
Created February 27, 2012 21:16
Mock :verify: method with MiniTest::Mock
class MiniTest::Mock
alias_method :__verify, :verify
undef :verify
end
mock = MiniTest::Mock.new
# call :verify on mock object
# ...
@ream88
ream88 / collegia-webfont.eot
Created February 9, 2012 15:20 — forked from tpryan/ribbon.html
Github Ribbon in CSS.
@ream88
ream88 / dabblet.css
Created January 31, 2012 18:50 — forked from chriscoyier/dabblet.css
Click open/close Dropdown in pure CSS
/* Click open/close Dropdown in pure CSS */
/* Disclaimer: Not the most semantic
thing in the universe. */
/* Forked from original idea
http://jsfiddle.net/paullferguson/Sv54G/3/ */
.tabs {
position: relative;
@ream88
ream88 / excel_template_handler.rb
Created January 24, 2012 15:30 — forked from stephencelis/redcarpet.rb
Markdown, Excel template handler for Rails 3.2.
class ActionView::Template
module Handlers
class Excel
def call(template)
%{
Tempfile.open('writeexcel').tap do |tmp|
WriteExcel.new(tmp.path).tap do |workbook|
#{template.source}
end.close
end.tap(&:rewind).read