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
document.addEvent('click:relay(a)', function(event, link) { | |
console.log('stopped event'); | |
event.stop(); | |
(function() { | |
console.log('sending google trackEvent'); | |
var pageTracker = _gat._getTracker('UA-241978-7'); | |
pageTracker._trackEvent('external', link.get('href')); | |
window.open(link.get('href')); | |
}).delay(100); |
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 "Deployanatoring teh codez!" | |
ssh linode-deploy ' | |
cd /data/alonetone/current; | |
if [[ $(git diff) > "" ]]; | |
then | |
echo "WARNING: local changes on server, exiting!"; | |
exit 0; | |
fi; |
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
## FAIL | |
## Attempting to iterate (chunkily) over 2000 records and instantiating 1 single object per iteration | |
## All of the below bloat to > 200MB on rails 2.3.x | |
# iterates in chunks of 10 | |
User.find_each(:batch_size => 10) do |user| | |
date = user.posts.find(:first).created_at | |
end | |
# iterates in chunks of 100 |
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 | |
# Simple deployment script | |
# | |
# Requires access to to github repository, as well as a host defined in | |
# ~/.ssh/config like so: | |
# | |
# Host myhost | |
# User appuser | |
# Hostname hostname |
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
check process rabbitmq_appname | |
with pidfile /var/run/rabbitmq/rabbitmq.pid | |
start program = "/engineyard/bin/rabbitmq" | |
stop program = "/engineyard/bin/rabbitmq" | |
group rabbitmq_appname |
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
This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set. | |
∴ rvm update --head | |
# ((Open a new shell)) | |
# If you do not already have the ruby interpreter installed, install it: | |
∴ rvm install 1.9.1 | |
# Switch to 1.9.1 | |
∴ rvm 1.9.1 |
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
set :mongrel_base_port, 5000 | |
set :mongrel_restart_delay, 30 | |
set :mongrel_count, 2 | |
namespace :mongrel do | |
task :restart, :roles => [:app], :except => {:mongrel => false} do | |
(mongrel_base_port..(mongrel_base_port+mongrel_count)).to_a.each do |port| | |
sudo "/usr/bin/monit restart mongrel_#{monit_group}_#{port}" | |
sleep mongrel_restart_delay | |
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
ActiveRecord::Schema.define(:version => 20091018223040) do | |
create_table "assets", :force => true do |t| | |
t.string "content_type" | |
t.string "filename" | |
t.integer "size" | |
t.integer "parent_id" | |
t.integer "site_id" | |
t.datetime "created_at" | |
t.string "title" |
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 'daemons' | |
options = { | |
:app_name => "task_server", | |
:dir_mode => :script, | |
:dir => "../log", # where the log/PID file will be dropped | |
:ontop => false, # should be false | |
:mode => :exec, | |
:backtrace => true, |
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
SC.RecordAttribute.registerTransform(SC.DateTime, { | |
/** Transforms a date to an integer of milliseconds since 1970 */ | |
/** @private - convert an int to a date */ | |
to: function(n, attr) { | |
/* Transform a date coming from rails in the format 2008/12/31 10:45:23 +0200 */ | |
return SC.DateTime.parse(n,'%Y/%m/%d %H:%M:%S'); | |
}, | |
/** @private - convert a date to an int */ | |
from: function(date) { | |
return date.get('milliseconds'); |