- Start a Sinatra server on port 4000
- GET / to that server triggers a
git pull
and mod_rails restart - Hit port 4000 locally after pushing
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
class UsersController < ApplicationController | |
respond_to :html, :xml, :json | |
# GET /users | |
# GET /users.xml | |
def index | |
@users = User.all | |
respond_with(@users) | |
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
#!/bin/bash | |
echo "Setting up chef..." | |
sudo apt-get -y update | |
sudo apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert | |
cd /tmp | |
wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz | |
tar zxf rubygems-1.3.4.tgz |
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 'redis' | |
module Nanite | |
class State | |
include Enumerable | |
# this class encapsulates the state of a nanite system using redis as the | |
# data store. here is the schema, for each agent we store a number of items, | |
# for a nanite with the identity: nanite-foobar we store the following things: | |
# |
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 | |
######## | |
# | |
# Ruby Oneliner FUN ! | |
# | |
# Cool, on http://science.howstuffworks.com/quote1463.htm | |
# there are 1982 quotes - lets get them and stuff them into a CSV file d(^^)p | |
# | |
# Dependencies: ruby, hpricot, open-uri, zsh (or whatever) |
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
$ git checkout 76a62f50f5831fe8be17ef6fa4e3e3e6d4dc3cbd (working old commit) | |
$ script/console | |
Loading development environment (Rails 2.3.2) | |
>> service_ads = ServiceAd.paginate :page => 1, :per_page => 6, :order=>'created_at DESC' | |
=> [] | |
>> service_ads.class | |
=> WillPaginate::Collection | |
$ git checkout bae6edc759de3faf147f9f21a1e1ae6168c0ae49 (buggy current commit) |
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 d = document.createElement("SCRIPT"); | |
d.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"; | |
document.body.appendChild(d); | |
$('a.photo')[0].setAttribute("href","http://www.viki.com/channels/3303-dr-g-y-las-mujeres/videos/35579/1") | |
$('a.photo')[0].click(); |
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 d = document.createElement("SCRIPT"); | |
d.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"; | |
document.body.appendChild(d); | |
alert("Ready to go to viki.com!"); | |
$('a.photo')[0].setAttribute("href","http://www.youtube.com/watch?v=NVh4OjSKk4g&feature=topvideos_mfh") | |
$('a.photo')[0].click(); |
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
#!/usr/bin/ruby | |
result = `/usr/bin/osascript <<EOT | |
tell application "Terminal" | |
activate | |
set Input to display dialog "Enter Text:" with title "Hello" with icon 0 default answer "" buttons {"OK"} default button 1 | |
return text returned of Input as string | |
end tell | |
EOT | |
` |
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
web: ruby dyno_process_analyse.rb -p $PORT | |
worker: ruby dyno_process_analyse.rb -p $PORT |