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
harvest() { | |
dow=$(date "+%u") | |
if [ -n "$2" ]; then | |
date=$2 | |
else | |
if [ $dow = "1" ]; then | |
date=$(date -v-mon -v -1w "+%Y-%m-%d 00:00:00") | |
else | |
date=$(date -v-mon "+%Y-%m-%d 00:00:00") | |
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
user app; | |
worker_processes 2; | |
error_log /home/app/logs/nginx.error.log info; | |
events { | |
worker_connections 1024; | |
} | |
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
# Deploying a Sinatra app to Heroku | |
## Database | |
The location of the database Heroku provides can be found in the environment | |
variable DATABASE_URL. Check the configure-block of toodeloo.rb for an example | |
on how to use this. | |
## Server | |
Heroku is serving your apps with thin, with means you have all your thin goodness available, | |
such as EventMachine. |
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
def partial(template, locals={}) | |
haml("_#{template}".to_sym, :locals => locals, :layout => false) | |
end | |
def errors_on(object, field) | |
return "" unless errors = object.errors.on(field) | |
errors.map {|e| e.gsub(/#{field} /i, "") }.join(", ") | |
end | |
def error_class(object, field) |
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
# gem install eventmachine | |
Building native extensions. This could take a while... | |
ERROR: Error installing eventmachine: | |
ERROR: Failed to build gem native extension. | |
/opt/rubyenterprise/bin/ruby extconf.rb | |
checking for rb_trap_immediate in ruby.h,rubysig.h... no | |
checking for rb_thread_blocking_region()... no | |
checking for inotify_init() in sys/inotify.h... no | |
checking for __NR_inotify_init in sys/syscall.h... no |
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
# gem install eventmachine | |
Building native extensions. This could take a while... | |
ERROR: Error installing eventmachine: | |
ERROR: Failed to build gem native extension. | |
/opt/rubyenterprise/bin/ruby extconf.rb | |
checking for rb_trap_immediate in ruby.h,rubysig.h... no | |
checking for rb_thread_blocking_region()... no | |
checking for inotify_init() in sys/inotify.h... no | |
checking for __NR_inotify_init in sys/syscall.h... no |
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
## Pseudo auto-respond-to in Sinatra. | |
module Sinatra | |
module AutoRespondTo | |
def self.registered(app) | |
app.after do | |
case request.accept.first | |
when "application/json" | |
body { body.to_json } | |
when "application/xml" |
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
-bash-3.00$ ruby -rrbconfig -e' puts Config::CONFIG.values.grep /-l/' | |
-lruby-static | |
-ldl -lcrypt -lm | |
-lruby-static | |
-lc | |
-DTEXT_DOMAIN="" -l/usr/sfw/include -l/usr/include |
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
-bash-3.00$ gem install eventmachine -- --with-opt-lib=/lib | |
WARNING: Installing to ~/.gem since /usr/local/lib/ruby/gems/1.8 and | |
/usr/local/bin aren't both writable. | |
Building native extensions. This could take a while... | |
ERROR: Error installing eventmachine: | |
ERROR: Failed to build gem native extension. | |
/usr/local/bin/ruby extconf.rb --with-opt-lib=/lib | |
checking for rb_trap_immediate in ruby.h,rubysig.h... no | |
checking for rb_thread_blocking_region()... no |
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 'eventmachine' | |
require 'socket' | |
module RPCServer | |
include EM::P::ObjectProtocol | |
def post_init | |
@obj = Hash.new | |
end | |
def receive_object method |
NewerOlder