- Install stud
$ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
- Download and install the powssl script
$ curl https://gist.githubusercontent.com/paulnicholson/2050941/raw/7e4d2178e3733bed18fdfe737277c3cb72241d39/powssl > ~/bin/powssl
$ chmod +x ~/bin/powssl
- Run powssl to create development certificate and configure stud.
$ powssl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InviteCode < ActiveRecord::Base | |
validate :invite_code, :presence => true | |
def to_s | |
invite_code | |
end | |
def self.generate | |
8.times.map { [*?a..?z,*?A..?Z].sample }.join | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Prepare ################################################################### | |
# Remove RVM | |
rvm implode | |
# Ensure your homebrew is working properly and up to date | |
brew doctor | |
brew update | |
## Install ################################################################### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
First install the required gems:
gem install octokit awesomeprint rainbow
Then run it to extract all of your open GitHub issues into files (with comments).
ruby my-gh-issues.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^I eval: (.*)$/ do |ruby| | |
p eval(ruby) | |
end | |
When /^I wait for (\d+) (second|minute)s?$/ do |count, period| | |
sleep count.to_i.send(period) | |
end | |
When /^I pause$/ do | |
print "Press [Enter] to continue" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run with this: | |
# $ curl "https://gist.github.com/raw/748530/5e74315dc6b6fe572f8a457536ad7eb17ad3f1e4/a.rb" > a.rb; while true; do clear; ruby a.rb | tee b.rb; sleep 0.3; mv -f b.rb a.rb; done | |
# Source: http://mamememo.blogspot.com/2010/09/qlobe.html | |
v=0000;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP | |
4ZojjV)O>qIH1/n[|2yE[>:ieC "%.#% :::##" 97N-A&Kj_K_><wS5rtWk@*a+Y5 | |
yH?b[F^e7C/56j|pmRe+:)B "##% ::##########" O98(Zh)'Iof*nm.,$C5Nyt= | |
PPu01Avw^<IiQ=5$'D-y? "##: ###############" g6`YT+qLw9k^ch|K'),tc | |
6ygIL8xI#LNz3v}T=4W "# #. .####:#######" lL27FZ0ij)7TQCI)P7u | |
}RT5-iJbbG5P-DHB<. " ##### # :############" R,YvZ_rnv6ky-G+4U' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is until there is a nested_has_many_through solution for Rails 3 | |
# to let us do something like: | |
# | |
# has_many :interests, :through => :users, :select => "DISTINCT tags.*", | |
# :class_name => "ActsAsTaggableOn::Tag" | |
def interests | |
ActsAsTaggableOn::Tag. | |
select("DISTINCT tags.*").joins(:taggings). | |
where("taggings.context" => "interests"). | |
where("taggings.taggable_type" => "User"). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# install all of http://github.com/phuibonhoa's TM bundles (OS X only) | |
# | |
echo "Installing bundles..." | |
# backup dir | |
if [ -d ~/desktop/_tm_bundle_backups ]; then rm -rf ~/desktop/_tm_bundle_backups; fi |