Skip to content

Instantly share code, notes, and snippets.

@dewski
dewski / locally.sh
Created January 20, 2012 16:58 — forked from jasonroelofs/setup-statsd.sh
Turn an EC2 micro instance into a StatsD/Graphite server
ec2-authorize default -p 2003
PROJECTS=$HOME/work/rails/*
for p in $PROJECTS; do
PROJECT=${p##*/}
alias $PROJECT="cd $p"
done
GEMS=$HOME/work/gems/*
for g in $GEMS; do
GEM=${g##*/}
alias $GEM="cd $g"
@dewski
dewski / gist:1205651
Created September 9, 2011 07:06
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
audio/webm weba
video/webm webm
video/ogg ogm
video/ogg ogv
video/ogg ogg
# Load application configuration
require 'ostruct'
require 'yaml'
config_path = File.expand_path('config/settings.yml', Rails.root)
begin
config = YAML.load_file(config_path)
rescue Errno::ENOENT
raise "Make sure the settings file #{config_path} exists."
var location;
var gotPosition = function (currentLocation) {
console.log(location.longitude);
// currentLocation will be the most up to date
// location will always have a value incase, but may not be the most up to date
// process with whatever you need to do, update interface, etc.
}
Titanium.Geolocation.getCurrentPosition(function(e){
Ti.API.info("received geo response");
railsrc_path = File.expand_path('~/.railsrc')
if (ENV['RAILS_ENV'] || defined?(Rails)) && File.exist?(railsrc_path)
begin
load railsrc_path
rescue Exception
warn "Could not load: #{railsrc_path}"
end
end
mysql_query("SELECT Events.* FROM Events INNER JOIN Artists ON Artists.id = Events.artist_id WHERE LOWER(Artists.name) = 'green day'")
var dt = $('.form dt');
if (dt.parents('fieldset').size() == 0) {
dt.css('width', maxLabelWidth + 'px');
var ddWidth = $('.form').width() - 45 - maxLabelWidth;
$('.form dd').css('width', ddWidth+'px');
$('.form dd input').css('max-width', ddWidth+'px');
}
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon