Skip to content

Instantly share code, notes, and snippets.

cat /usr/local/rvm/bin/bootup_god
#!/usr/bin/env bash
if [[ -s "/usr/local/rvm/environments/ruby-1.9.2-p136@global" ]] ; then
echo '1'
source "/usr/local/rvm/environments/ruby-1.9.2-p136@global"
echo '2'
exec god "$@"
else
echo "ERROR: Missing RVM environment file: '/usr/local/rvm/environments/ruby-1.9.2-p136@global'" >&2
module M
CONTENT = foo
def foo
'hello'
end
end
puts M::CONTENT
.rvmrc don't change ruby/gemset:
capdeploy@cms:~$ cd /srv/media_qa/current
+ cd /srv/media_qa/current
+ builtin cd /srv/media_qa/current
+ local result=0
+ __rvm_project_rvmrc
+ local cwd
+ cwd=/srv/media_qa/current
+ :
ccapdeploy@cms:~$ cd /srv/media_qa/current
+ cd /srv/media_qa/current
+ builtin cd /srv/media_qa/current
+ local result=0
+ __rvm_project_rvmrc
+ local cwd
+ cwd=/srv/media_qa/current
+ :
+ [[ -z /srv/media_qa/current ]]
+ [[ /home/capdeploy = \/\s\r\v\/\m\e\d\i\a\_\q\a\/\c\u\r\r\e\n\t ]]
[2011-03-04 13:58:31] GEM_PATH="/home/oren/.rvm/gems/ruby-1.9.2-p180:/home/oren/.rvm/gems/ruby-1.9.2-p180@global:/home/oren/.rvm/gems/ruby-1.9.2-p180@global" GEM_HOME="/home/oren/.rvm/gems/ruby-1.9.2-p180" "/home/oren/.rvm/rubies/ruby-1.9.2-p180/bin/ruby" "/home/oren/.rvm/src/rubygems-1.5.2/setup.rb"
RubyGems 1.5.2 installed
=== 1.5.2 / 2011-02-10
NOTE: RubyGems 1.5.0 and 1.5.1 have a broken <tt>gem update --system</tt>.
To upgrade you'll need to use the manual upgrade recipe. Using sudo/su as
appropriate:
qa.rb
-----
default_environment['PATH']='$HOME/.rvm/bin:$PATH'
set :application_directory, "test_project"
set :rails_env, "qa"
set :main_server, 'ogolan'
server "#{main_server}", :web, :app, :db, :primary => true
set :deploy_to, "/srv/#{application_directory}"
Sinatra project structure
app.rb # require sinatra, haml, vendor'd gems, models/init, routes/init, helpers/init
helpers/
init.rb # Requires each helper file
helper1.rb # Related helper methods
models/
init.rb # Require sequel, set up the DB; require each model, in controlled order
goal:
-----
return an array of names that start with j and sorted by id
["josh", "jordan"]
arr = [{name: 'jordan',id: 3}, {name: 'josh',id: 1}, {name: 'rob',id: 5}]
1)
arr.select!{ |a| a[:name][/\Aj/] }
@oren
oren / simulator.js
Created July 17, 2012 04:55
functional test
// Elphi System Simulator in Node.js
// TODO: check failure case
// 0) request times
// 0) server hangs
// 0) HTTP request timeouts where we never get a response
// 1) no api
// 2) no proxy on
// 3) plugs unresponsive
// The server's main routes function
//
// Supports the following end-points:
// POST /push
// POST /register
// POST /register.php
// GET /health
// GET /health.txt
function router(config, req, res) {