FridayHug.com http://fridayhug.com
The Smallest Rails App http://thesmallestrailsapp.com
%w(action_controller/railtie coderay).each &method(:require)
# gem install ruby-prolog | |
# https://github.com/preston/ruby-prolog/ | |
# Prolog code: | |
# | |
# mother_child(trude, sally). | |
# | |
# father_child(tom, sally). | |
# father_child(tom, erica). | |
# father_child(mike, tom). |
require "openssl" | |
require "digest" | |
def aes128_cbc_encrypt(key, data, iv) | |
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize) | |
iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize) | |
aes = OpenSSL::Cipher.new('AES-128-CBC') | |
aes.encrypt | |
aes.key = key | |
aes.iv = iv |
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential | |
apt-get -y install git-core | |
# Install rbenv | |
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
# Add rbenv to the path: |
# db/migrate/20111218135715_globalize_models.rb | |
class GlobalizeModels < ActiveRecord::Migration | |
def up | |
NewsItem.create_translation_table!( | |
{:title => :string, :body => :text}, | |
{:migrate_data => true} | |
) | |
end |
FridayHug.com http://fridayhug.com
The Smallest Rails App http://thesmallestrailsapp.com
%w(action_controller/railtie coderay).each &method(:require)
build_package_combined_patch() { | |
local package_name="$1" | |
{ | |
curl https://raw.github.com/skaes/rvm-patchsets/master/patchsets/ruby/1.9.3/p448/railsexpress | xargs -I % curl https://raw.github.com/skaes/rvm-patchsets/master/patches/ruby/1.9.3/p448/% | patch -p1 | |
autoconf | |
./configure --prefix="$PREFIX_PATH" $CONFIGURE_OPTS | |
make -j 8 | |
make install | |
} >&4 2>&1 |
Following the pattern set forth by the https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview#google-oauth2-example
Gemfile
gem 'omniauth-jwt' #Note this is the modified version at https://github.com/jbarona/omniauth-jwt/tree/flexible-options
▶ brew list -1 | while read line; do brew unlink $line; brew link $line; done | |
Unlinking /usr/local/Cellar/appledoc/2.2... 0 links removed | |
Linking /usr/local/Cellar/appledoc/2.2... 1 symlinks created | |
Unlinking /usr/local/Cellar/autoconf/2.69... 0 links removed | |
Linking /usr/local/Cellar/autoconf/2.69... 18 symlinks created | |
Unlinking /usr/local/Cellar/bash-completion/1.3... 184 links removed | |
Linking /usr/local/Cellar/bash-completion/1.3... 182 symlinks created | |
Unlinking /usr/local/Cellar/bgrep/0.2... 0 links removed | |
Linking /usr/local/Cellar/bgrep/0.2... 1 symlinks created | |
Unlinking /usr/local/Cellar/binutils/2.24... 49 links removed |
class PHPass | |
def self.itoa64 | |
'./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' | |
end | |
def self.crypt_private(password, setting) | |
output = '*0' | |
if setting[0,2] == output |