Skip to content

Instantly share code, notes, and snippets.

View invalidusrname's full-sized avatar
🤷‍♀️

Matt invalidusrname

🤷‍♀️
View GitHub Profile
@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')

(a gist based on the old toolmantim article on setting up remote repos)

To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.

This is somewhat of a follow-up to the previous article setting up a new rails app with git.

For the impatient

Set up the new bare repo on the server:

@joshwand
joshwand / What Killed Waterfall could Kill Agile.textile
Created November 22, 2010 23:50
What Killed Waterfall Could Kill Agile.

ganked from unreadable scribd doc here: http://cleancoder.posterous.com/what-killed-waterfall-could-kill-agile

What Killed Waterfall could Kill Agile.

Robert C. Martin
20 Nov, 2010

In 1970 a software engineer named Dr. Winston W. Royce wrote a seminal paper entitled Managing the Development of Large Software Systems. This paper described the software process that Royce felt was appropriate for large-scale systems. As a designer for the Aerospace industry, he was uniquely qualified.

He began the paper by setting up a straw-man process to knock down. He described this naïve process as “grandiose”. He depicted it with a simple diagram on an early page of his paper. Then the paper methodically tears this “grandiose” process apart. In the end, Royce proposed a far more nuanced and insightful approach, leaving the reader to giggle at the silliness of the “grandiose” model.

if defined?(RSpec)
namespace :rcov do
RSpec::Core::RakeTask.new(:rspec_aggregate) do |task|
task.pattern = 'spec/**/*_spec.rb'
task.rspec_opts = "--format progress"
task.rcov = true
task.rcov_opts = "--rails --exclude osx\/objc,spec,gems\/ " +
"--aggregate tmp/coverage.data"
end
@andruby
andruby / deploy.rb
Created January 26, 2011 19:48
Start and Stop tasks for resque workers, with capistrano deploy hook (without God)
after "deploy:symlink", "deploy:restart_workers"
##
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
cmd = "cd #{fetch(:latest_release)} && #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}"
@jbarnette
jbarnette / example.rb
Created April 6, 2011 14:55
A naïve state machine for ActiveRecord. Ruby 1.9.
require "stateful"
class Folder < ActiveRecord::Base
include Stateful
# ...
stateful do
state :active
state :inactive
@mrflip
mrflip / auth_and_rate_limit.rb
Created May 11, 2011 06:59
API key authentication + rate limiting in Goliath using MongoDB (incomplete sketch)
#!/usr/bin/env ruby
$: << File.join(File.dirname(__FILE__), '../lib')
require 'goliath'
require 'em-mongo'
require 'em-http'
require 'em-synchrony/em-http'
require 'yajl/json_gem'
require 'goliath/synchrony/mongo_receiver' # has the aroundware logic for talking to mongodb
require File.join(File.dirname(__FILE__), 'auth_receiver')
@mndoci
mndoci / iam_fog.rb
Created May 29, 2011 03:48 — forked from zapnap/iam_fog.rb
Using Amazon IAM with Fog (example)
# via http://blog.zerosum.org/2011/03/02/better-aws-access-control-with-iam-and-fog.html
require 'fog'
username = 'testuser'
bucket = 'uniquebucketname1234'
aws_credentials = {
:aws_access_key_id => 'YOUR-ACCESS-KEY-ID',
:aws_secret_access_key => 'YOUR-SECRET-ACCESS-KEY'
@ytaniike
ytaniike / 256colors_w_numbers.pl
Created June 1, 2011 13:39
Convenient for setting up tmux and other terminal software.
#!/usr/bin/perl
# displays the 256 colors specified in tmux's "colourNN" way.
# June, 1st 2011 by Yasunori Taniike (@ytaniike).
use strict;
use warnings;
my $prefix_bl = "\x1b[38;5;0;48;5;";
my $prefix_wl = "\x1b[38;5;15;48;5;";
my $suffix = "\x1b[0m";
@DefV
DefV / gist:1018547
Created June 10, 2011 09:35
ruby 1.9.2-p180 patched zip failure
ruby-1.9.2-p180-patched :001 > (1..2).zip(1..2)
(irb):1: [BUG] Bus Error
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
-- control frame ----------
c:0027 p:---- s:0092 b:0092 l:000460 d:000460 CFUNC :next
c:0026 p:---- s:0090 b:0090 l:000085 d:000089 IFUNC
c:0025 p:---- s:0088 b:0088 l:000087 d:000087 CFUNC :each
c:0024 p:---- s:0086 b:0086 l:000085 d:000085 CFUNC :zip
c:0023 p:0014 s:0082 b:0082 l:001d18 d:000081 EVAL (irb):1