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
before_filter :set_localization | |
def set_localization | |
# Set the language | |
I18n.locale = if session[:locale] | |
session[:locale] | |
elsif logged_in? && current_member.locale | |
current_member.locale.code | |
elsif !accepted_languages.empty? | |
accepted_languages.first.first |
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
rescue_from ActiveRecord::RecordNotFound, :with => :missing_record | |
rescue_from ForbiddenError, :with => :unauthorised | |
def missing_record | |
render :status => 404, :file => '404', :layout => true | |
end | |
def unauthorised | |
render :status => 403, :file => '403', :layout => true | |
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
def f(ra,n) | |
r=0 | |
ra.each {|x| r+=1 if x.include? n} | |
r | |
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
require 'rubygems' | |
require 'sinatra' | |
require 'httparty' | |
class Representative | |
include HTTParty | |
end | |
get '/' do | |
erb :form | |
end | |
get '/:username' do |
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 | |
# belongs in /etc/init.d/cruisecontrol | |
PIDFILE=/opt/cruisecontrol/cc.pid | |
start() { | |
ebegin "Starting CruiseControl" | |
cd /opt/cruisecontrol/ | |
./cruisecontrol.sh > /dev/null 2>&1 | |
eend $? |
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
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; | |
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION; | |
FLUSH PRIVILEGES; |
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
run "rm README public/index.html public/favicon.ico public/robots.txt" | |
gem 'aws-s3', :lib => 'aws/s3' | |
gem 'geokit' | |
gem 'oauth' | |
gem 'factory_girl' | |
gem 'paperclip' | |
gem 'facebooker' | |
gem 'binarylogic-authlogic', :lib => 'authlogic', :source => 'http://gems.github.com' |
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
oli@laptop]:project $ sudo gem uninstall geokit | |
Successfully uninstalled geokit-1.5.0 | |
[oli@laptop]:project $ sudo gem install geokit | |
Successfully installed geokit-1.5.0 | |
1 gem installed | |
Installing ri documentation for geokit-1.5.0... | |
Installing RDoc documentation for geokit-1.5.0... | |
Could not find main page README.txt | |
Could not find main page README.txt |
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
<div id="event_22" class="event vevent"> | |
<h4 class="summary"><a class="url" href="/places/nepenthe/events/2010-11-07-sunday-sessions">Sunday Sessions</a></h4> | |
<p class="date"><span title="2010-11-07T13:00:00" class="dtstart"> 1pm</span> — <span title="2010-11-07T17:00:00" class="dtstart"> 5pm 07 November 2010</span></p> | |
<p class="location"><span class="fn">Nepenthe</span>, Jones Road, Balhannah, South Australia, 5242</p> | |
<div class="geo"> | |
<abbr title="-35.006217" class="latitude">-35.006217</abbr> | |
<abbr title="138.825938" class="longitude">138.825938</abbr> | |
</div> | |
</div> |
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
var xhr = Titanium.Network.createHTTPClient(); | |
var url = 'http://greatsawineadventure.com.au/wineries/'+win.place.slug+'.json' | |
xhr.open('GET',url); | |
xhr.onload = function() { | |
var resp = eval('('+this.responseText+')'); | |
} | |
xhr.send(); |