Skip to content

Instantly share code, notes, and snippets.

@theconektd
theconektd / production.rb
Created June 16, 2009 23:21
Consolidate pre-deployment tasks before shipping to Heroku
# Supresses automatic updates of SASS so as not to offend your Heroku slug
Sass::Plugin.options[:never_update] = true
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@hbrandl
hbrandl / gist:547170
Created August 24, 2010 08:09
.irbrc for rails3 (based on tech-angels.fr)
#making .irbrc posted at http://www.tech-angels.fr/post/963080350/improve-irb-and-fix-it-on-mac-os-x
#work with rails3
require 'rubygems'
#rails3: be sure to include wirble and hirb in your Gemfile
require 'wirble'
require 'hirb'
Wirble.init
Wirble.colorize
# hirb (active record output format in table)
@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork git@github...my-fork.git
@iHiD
iHiD / cloudfront.rb
Created May 4, 2011 14:57
Ruby Signed Expiring Cloudfront URL
# A simple function to return a signed, expiring url for Amazon Cloudfront.
# As it's relatively difficult to figure out exactly what is required, I've posted my working code here.
# This will require openssl, digest/sha1, base64 and maybe other libraries.
# In my rails app, all of these are already loaded so I'm not sure of the exact dependencies.
module CloudFront
def get_signed_expiring_url(path, expires_in, private_key_filename, key_pair_id)
# AWS works on UTC, so make sure you are not using local time
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 31, 2024 22:29
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@bradediger
bradediger / gist:4137531
Created November 23, 2012 22:14
Redis cache hit ratio
#!/usr/bin/env ruby
hits_ = nil
misses_ = nil
loop do
`redis-cli info | grep keyspace` =~ /hits:(\d+).*misses:(\d+)/m
hits, misses = $1.to_i, $2.to_i
if hits_
@BPScott
BPScott / QR-Code-Example
Created April 18, 2013 13:48
QR Code generation and instant preview from the command line
# Generating throwaway QR codes from the command line for shunting URLS to mobile devices
brew install qrencode
qrencode -o - http://www.google.com | open -f -a preview
@rxaviers
rxaviers / gist:7360908
Last active June 1, 2024 21:19
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
# MODEL
class Case < ActiveRecord::Base
include Eventable
has_many :tasks
concerning :Assignment do
def assign_to(new_owner:, details:)
transaction do