Skip to content

Instantly share code, notes, and snippets.

View Sutto's full-sized avatar

Darcy Laycock Sutto

View GitHub Profile
@Sutto
Sutto / app.rb
Created October 25, 2009 02:30 — forked from zacheryph/app.rb
require 'sinatra/base'
class Bacon < Sinatra::Base
enable :logging, :clean_trace
get '/' do
'Hello from Sinatra!'
end
end
function getPosition() {
if($('form#plan-journey').length > 0) {
// native support via the W3C Spec
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(revGeocode);
// support via the wrapper
} else if(geo_position_js.init()) {
geo_position_js.getCurrentPosition(revGeocode);
// nothing available
} else {
@Sutto
Sutto / deploy.rake
Created January 16, 2010 08:40
Super Simple Git, Bundler and Unicorn deploys
namespace :deploy do
def config(key)
(@config ||= YAML.load_file("config/deploy.yml").symbolize_keys)[key.to_sym]
end
# Hooks as needed
task :local_before do
end
@Sutto
Sutto / gemset.fish
Created February 18, 2010 02:17
Simple gem set switching for ruby
function gemset --description 'Switches gemset'
set gemset_name $argv[1]
if [ -n "$gemset_name" ]
set gem_dir "$HOME/.gems-switcher/$gemset_name"
echo "Using gemset: $gemset_name (location: '$gem_dir')"
mkdir -p "$gem_dir/bin"
set -xg PATH "$gem_dir/bin" $GEMLESS_PATH
set -xg GEM_HOME "$gem_dir"
set -xg GEM_PATH "$gem_dir"
else
@Sutto
Sutto / _maps.sass
Created March 17, 2010 15:21
Unobtrusive Gmaps w/ html5 data attributes and rails 3
.gmap.map-preview
:width 540px
:height 400px
:margin 5px auto
:border 5px solid #DDD
:background #F1F1F1 url('/images/map-placeholder.jpg') center center no-repeat
var BHM;
if(!BHM) BHM = {};
(function(ns, $) {
var defaultNSAttrs = {};
var makeNS = function(o) {
return $.extend(o, defaultNSAttrs);
};
if defined?(Rails)
def rr
if Rails::VERSION::STRING == "3.0.0.beta"
puts "Reloading..."
ActionDispatch::Callbacks.new(lambda {}, false).call({})
else
reload!
end
end
BHM.withNS('CKEditor', function(ns) {
ns.editorSelector = '.ckeditor textarea';
ns.editorOptions = {
toolbar: 'bhm',
width: '74%'
};
ns.toolbar_layout = [
['Source','-','Templates'], ['Cut','Copy','Paste','PasteText','PasteFromWord','-', 'SpellChecker', 'Scayt'],
Bighelpmob::Application.routes.draw do |map|
namespace :admin do
resources :users do
resources :participations
end
resources :missions
resources :organisations
resources :pickups
resources :contents