Skip to content

Instantly share code, notes, and snippets.

@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 / 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:3074893
Created July 9, 2012 07:53
Colored diff as html #snippet
vim -d old.rb new.rb +:TOhtml +:x +:qa
@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 / retina-background-image.scss
Last active October 7, 2015 00:17
@mixin retina-background-image #snippet
// Helps you to provide provide retina optimized backgrounds
// in an innovative and easy way. (Requires compass).
//
// ==== Options
// * <tt>$url</tt> is your background image.
// * <tt>$retina_url</tt> is your retina optimized background image.
// If no $retina_url option is provided or it equals to `false`, $url
// is used for the retina background image, but its size it cut to half.
//
// ==== Examples
@ream88
ream88 / Rakefile
Created July 18, 2012 11:24
Minitest rake task
require 'rake'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.test_files = Dir.glob('spec/**/*_spec.rb')
end
task(default: :test)
@ream88
ream88 / response_matchers.rb
Created July 21, 2012 10:16
minitest-matchers for controller/functional specs
# Simple minitest matchers which will make your controller/functional specs less pain in the ass.
#
# ==== Dependencies
#
# gem 'minitest'
# gem 'minitest-matchers'
#
# ==== Matchers
#
# +must_have_status+ and its opposite +wont_have_status+ take both one argument which must be one of the following:
@ream88
ream88 / Gemfile
Created August 27, 2012 10:39
Sprockets/Asset Pipeline in every project
source :rubygems
gem 'actionpack', '~> 3.2', require: 'sprockets/static_compiler'
gem 'filewatcher'
gem 'rake'
gem 'sprockets'
gem 'coffee-script'
gem 'sass'
gem 'uglifier'
@ream88
ream88 / gitrm.rb
Created January 16, 2013 11:04
Merge two diverged branches. `git status --porcelain|ruby gitrm.rb`
ARGF.each_line do |line|
action, file = line.split
Kernel.system "git rm -f #{file}" if %w[A DU].include?(action)
end
[class^="icon-"],
[class*=" icon-"] {
font-family: inherit;
&:before {
font-family: FontAwesome;
}
}