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
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
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
# List of environments and their heroku git remotes | |
ENVIRONMENTS = { | |
:staging => 'myapp-staging', | |
:production => 'myapp-production' | |
} | |
namespace :deploy do | |
ENVIRONMENTS.keys.each do |env| | |
desc "Deploy to #{env}" | |
task env do |
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
# Implements the algorithm used by the National Resident Matching Program | |
# (NRMP) to match residency and fellowship applicants to programs. The | |
# algorithm is described here: | |
# http://www.nrmp.org/fellow/algorithm.html | |
# and again here: | |
# http://www.nrmp.org/res_match/about_res/algorithms.html | |
# | |
# The Test class computes the example match scenario described on those pages. | |
module Match |
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
connection = Faraday::Connection.new('http://example.com') do |builder| | |
builder.request :url_encoded # for POST/PUT params | |
builder.adapter :net_http | |
end | |
# same as above, short form: | |
connection = Faraday.new 'http://example.com' | |
# GET | |
connection.get '/posts' |
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
set :domain, ENV["domain"] | |
set :application, domain | |
set :user, ENV["user"] | |
set :destination, ENV["destination"] || domain | |
set :web_conf, ENV["web_conf"] || ENV["environment"] || 'production' | |
raise "please set domain=app.domain.name.com" unless domain | |
raise "please set user=server_username" unless user | |
set :port, ENV["port"] || 1234 | |
set :repository, "." |
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
# https://gist.github.com/1214011 | |
module WillPaginate | |
module ActionView | |
def will_paginate(collection = nil, options = {}) | |
options[:renderer] ||= BootstrapLinkRenderer | |
super.try :html_safe | |
end | |
class BootstrapLinkRenderer < LinkRenderer |
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
## Prepare ################################################################### | |
# Remove RVM | |
rvm implode | |
# Ensure your homebrew is working properly and up to date | |
brew doctor | |
brew update | |
## Install ################################################################### |
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
marca@SCML-MarcA:/usr/local$ growlnotify | |
dyld: Symbol not found: _kSecRandomDefault | |
Referenced from: /usr/local/bin/growlnotify | |
Expected in: /System/Library/Frameworks/Security.framework/Versions/A/Security | |
in /usr/local/bin/growlnotify | |
Trace/BPT trap | |
marca@SCML-MarcA:/usr/local$ brew versions growlnotify | |
1.3 git checkout 2e23ced Library/Formula/growlnotify.rb | |
1.2.2 git checkout 5fb24f5 Library/Formula/growlnotify.rb |
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
# As root user | |
sudo su | |
# Update the OS | |
sudo apt-get update -y | |
# Add this to ~/.bashrc to remove timezone warnings | |
echo 'export LC_ALL="en_US.UTF-8"' >> ~/.bashrc | |
source ~/.bashrc |
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
class InvitationsController < Devise::InvitationsController | |
# GET /resource/invitation/accept?invitation_token=abcdef | |
def edit | |
if params[:invitation_token] && self.resource = resource_class.to_adapter.find_first( :invitation_token => params[:invitation_token] ) | |
session[:invitation_token] = params[:invitation_token] | |
render :edit | |
else | |
set_flash_message(:alert, :invitation_token_invalid) | |
redirect_to after_sign_out_path_for(resource_name) |
OlderNewer