Skip to content

Instantly share code, notes, and snippets.

View infinityrobot's full-sized avatar
🦁

Ritchie Blair infinityrobot

🦁
  • Infinity Robot
  • Australia
View GitHub Profile
@twe4ked
twe4ked / invite_code.rb
Created June 19, 2012 02:58
Beta code system.
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
@paulnicholson
paulnicholson / powssl
Last active January 15, 2025 19:40
ssl with pow using stud

Instructions

  • 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
@brentertz
brentertz / rvm2rbenv.txt
Created November 21, 2011 23:00
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
@jwo
jwo / registrations_controller.rb
Created September 30, 2011 23:11
API JSON authentication with Devise
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
@ryanb
ryanb / README.md
Created May 15, 2011 16:24 — forked from copiousfreetime/my-gh-issues.rb
My Github Issues

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
@bjeanes
bjeanes / steps.rb
Created March 30, 2011 17:04
steps.rb
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"
# 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 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").
@mkdynamic
mkdynamic / bundles.sh
Created June 18, 2010 02:31
Install all of http://github.com/phuibonhoa's TM bundles (OS X only)
#!/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
@ambethia
ambethia / rails-3.0-pre-dev-stack-snow-leopard.md
Created February 3, 2010 17:31
Rails Dev Stack on Snow Leopard

Rails Dev Stack on Snow Leopard

(from a scratch install). Kinda, I imported my user home (~) from a Time Machine backup.

Homebrew

sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local