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
Warden::Manager.serialize_into_session{|user| user.id } | |
Warden::Manager.serialize_from_session{|id| User.get(id) } | |
Warden::Manager.before_failure do |env,opts| | |
# Sinatra is very sensitive to the request method | |
# since authentication could fail on any type of method, we need | |
# to set it for the failure app so it is routed to the correct block | |
env['REQUEST_METHOD'] = "POST" | |
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
# Add this to your boot.rb before Padrino.load! | |
# and add: gem 'pry' | |
# to your Gemfile and run bundle to install. | |
begin | |
require 'pry' | |
$VERBOSE = nil | |
IRB = Pry | |
$VERBOSE = false | |
rescue LoadError |
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
#!/bin/bash | |
echo -e "\e[1;36mUPDATING PACKAGES\e[00m" | |
echo "deb http://nginx.org/packages/debian/ squeeze nginx" | tee -a /etc/apt/sources.list | |
echo "deb-src http://nginx.org/packages/debian/ squeeze nginx" | tee -a /etc/apt/sources.list | |
apt-get --quiet --assume-yes update | |
echo -e "\e[1;36mINSTALLING PACKAGES\e[00m" | |
apt-get --assume-yes --allow-unauthenticated --quiet install build-essential bzip2 openssl libssl-dev libreadline6 libreadline6-dev libxml2-dev libxslt-dev libsqlite3-dev sqlite3 subversion vim zsh zlib1g zlib1g-dev nginx sudo git python libcurl4-openssl-dev libpcre3-dev mercurial libyaml-dev imagemagick | |
useradd -m -c "spree" -s /bin/bash spree | |
adduser spree sudo | |
curl http://betterthangrep.com/ack-standalone > /usr/bin/ack && chmod 0755 /usr/bin/ack |
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
if [ -d ~/.oh-my-zsh ] | |
then | |
echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install" | |
exit | |
fi | |
echo "\033[0;34mCloning Oh My Zsh...\033[0m" | |
/usr/bin/git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh | |
echo "\033[0;34mLooking for an existing zsh config...\033[0m" |
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
#!/bin/sh | |
mkdir ~/local | |
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.zshrc | |
. ~/.zshrc | |
git clone git://github.com/joyent/node.git | |
cd node | |
./configure --prefix=~/local | |
make 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
--- | |
en-GB: | |
number: | |
currency: | |
format: | |
format: "%u%n" | |
unit: "£" | |
precision: 2 | |
separator: '.' | |
delimiter: ',' |
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
apt-get install build-essential libssl-dev libcurl4-openssl-dev libreadline-gplv2-dev zlib1g-dev libxslt1-dev libxml2-dev | |
cd /usr/src | |
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p385.tar.gz | |
tar zxvf ruby-1.9.3-p385.tar.gz | |
cd ruby-1.9.3-p385 | |
./configure | |
make && make install | |
cd ext/openssl |
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
require 'rubygems' | |
require 'bundler/setup' | |
Bundler.require | |
refresh_token = 'REDACTED' | |
CLIENT_ID = 'REDACTED' | |
CLIENT_SECRET = 'REDACTED' | |
client = OAuth2::Client.new(CLIENT_ID, CLIENT_SECRET, { | |
:authorize_url => 'https://accounts.google.com/o/oauth2/auth', |
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
require 'rubygems' | |
require 'google/api_client' | |
client = Google::APIClient.new( | |
application_name: 'Ruby Google Calendar Example', | |
application_version: '1.0.0') | |
calendar = client.discovered_api('calendar', 'v3') | |
key = Google::APIClient::PKCS12.load_key('./keys/creds.p12', 'notasecret') | |
asserter = Google::APIClient::JWTAsserter.new( |
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
Show hidden characters
{ | |
"GenServer Template": { | |
"scope": "elixir", | |
"prefix": "gs", | |
"body": [ | |
"defmodule ${1}.${2} do", | |
"\tuse GenServer", | |
"", | |
"\t# Client", | |
"", |