This file contains 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
# Shortcut for `bundle exec rails` and `bundle exec rake`. | |
# If bin/rails and bin/rake are available, use them instead as they are much | |
# faster to execute than `bundle exec`. | |
function r() { | |
if [[ "g|generate|c|console|s|server|db|dbconsole|r|runner|new" =~ $1 ]]; then | |
if [ -x bin/rails ]; then | |
bin/rails "$@" | |
elif [ -x script/rails ]; then | |
script/rails "$@" | |
else |
This file contains 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 ruby | |
# Lean Architecture example in Ruby - without ContextAccessor | |
# In this example, the context passes the needed roles into each method it | |
# invokes, and so the roles have no reference back to the context. | |
# Model class with no external dependenices. Includes a simple find method | |
# to create and store instances given an id - for illustration purposes only. | |
class Account | |
attr_reader :account_id, :balance |
This file contains 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
# features/support/missing_translations.rb | |
missing_translations = [] | |
After do |scenario| | |
temp = all('.translation_missing') | |
if temp.any? | |
missing_translations << temp.to_a | |
raise "Missing Translation" | |
end |
This file contains 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
module Facebook | |
# | |
# Facebook request tools | |
# | |
class Request | |
class << self | |
def parse_signed_request(signed_request, secret, max_age=3600) | |
encoded_sig, encoded_envelope = signed_request.split('.', 2) | |
envelope = JSON.parse(base64_url_decode(encoded_envelope)) | |
algorithm = envelope['algorithm'] |
This file contains 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
#!/bin/bash | |
## BASE ######### | |
#BASH | |
alias ..="cd .." | |
alias j="jobs" | |
#GIT | |
alias gs="git status" | |
function ga { git add $* && gs; } |
This file contains 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
# $APP=$1 | |
# S3_KEY=$2 | |
# S3_SECRET=$3 | |
# S3_BUCKET=$4 | |
# GEMS=$5 | |
gem install heroku --no-rdoc --no-ri | |
refinerycms $APP --heroku -g aws-s3,refinerycms-inquiries | |
# ,$5 | |
cd $APP |
This file contains 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
# inheritance in yml files: | |
development: &defaults | |
adapter: mysql | |
encoding: utf8 | |
database: acme_development | |
username: root | |
test: | |
<<: *defaults |
This file contains 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
# based on: | |
# http://www.hackido.com/2010/12/install-ruby-on-rails-on-ubuntu.html | |
# http://thekindofme.wordpress.com/2010/10/24/rails-3-on-ubuntu-10-10-with-rvm-passenger-and-nginx/ | |
# http://ascarter.net/2011/01/02/rails-development-on-ubuntu-10.10.html | |
sudo apt-get update | |
sudo apt-get dist-upgrade | |
sudo apt-get install build-essential | |
sudo apt-get install git-core |
This file contains 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
module Core | |
def self.included(mod) | |
url = ENV['CORE_URL'] ? URI.parse(ENV['CORE_URL']) : URI.parse('postgres://postgres@localhost/heroku') | |
mod.establish_connection( | |
:adapter => "postgresql", | |
:host => url.host, | |
:username => url.userinfo.split(':')[0], | |
:password => url.userinfo.split(':')[1], | |
:database => url.path[1..-1] | |
) |
This file contains 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
## based on the example at: | |
## http://gist.github.com/17371 | |
## | |
## put me in lib/un_haml.rb (in the haml-based project) | |
## | |
## call me on the command line thus: | |
## $ script/runner UnHaml app/views/layouts/application.html.haml | |
## $ script/runner UnHaml */*/*/*.haml | |
## | |
class UnHaml < Haml::Engine |