This file contains 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 'rack' | |
require 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
def call(env) | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) |
This file contains 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 | |
### 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 |
This file contains 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 'zmq' | |
z = ZMQ::Context.new | |
s = z.socket(ZMQ::UPSTREAM) | |
s.connect "tcp://127.0.0.1:5555" | |
while true | |
puts s.recv | |
end |
This file contains 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 'base64' | |
file = ARGV[0] | |
mimetype = `file -b --mime-type #{file}`.gsub(/\n/,'') | |
puts "data:#{mimetype};base64," << Base64.encode64(File.read(file)).gsub(/\n/, '') |
This file contains 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
--- a/load.c 2010-10-23 05:36:38.000000000 -0400 | |
+++ b/patchload.c 2011-06-05 08:58:00.000000000 -0400 | |
@@ -40,14 +40,6 @@ | |
VALUE ary; | |
long i; | |
- for (i = 0; i < RARRAY_LEN(load_path); ++i) { | |
- VALUE str = rb_check_string_type(RARRAY_PTR(load_path)[i]); | |
- if (NIL_P(str) || !rb_is_absolute_path(RSTRING_PTR(str))) | |
- goto relative_path_found; |
This file contains 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
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz | |
$ tar xzvf ./nginx-0.8.52.tar.gz | |
$ rm ./nginx-0.8.52.tar.gz | |
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc | |
$ passenger-install-nginx-module | |
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation | |
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52 | |
# Where do you want to install Nginx to?: /opt/nginx |
This file contains 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
# Date.parse() with Ruby 1.9 is now defaulting to the European date style where the format is DD/MM/YYYY, not MM/DD/YYYY | |
# patch it to use US format by default | |
if RUBY_VERSION >= '1.9' | |
class String | |
def to_date | |
if self.blank? | |
nil | |
elsif self =~ /(\d{1,2})\/(\d{1,2})\/(\d{4})/ | |
::Date.civil($3.to_i, $1.to_i, $2.to_i) | |
else |
This file contains 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/local/lib/node/.npm/socket.io/0.8.4/package/lib/manager.js:610 | |
transport.payload(this.closed[data.id]); | |
^ | |
TypeError: Object #<WebSocket> has no method 'payload' | |
at Manager.handleClient (/usr/local/lib/node/.npm/socket.io/0.8.4/package/lib/manager.js:610:19) | |
at Manager.handleUpgrade (/usr/local/lib/node/.npm/socket.io/0.8.4/package/lib/manager.js:564:8) | |
at HTTPServer.<anonymous> (/usr/local/lib/node/.npm/socket.io/0.8.4/package/lib/manager.js:100:10) | |
at HTTPServer.emit (events.js:81:20) | |
at Socket.<anonymous> (http.js:1035:14) | |
at Socket._onReadable (net.js:683:27) |
This file contains 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 'nokogiri' | |
require 'eeepub' | |
DOC_TITLE = 'Ruby on Rails Guides' | |
def get_pages(src_dir) | |
index_file = File.join(src_dir, 'index.html') | |
section = nil | |
pages = [{ :section => section, :title => DOC_TITLE, :path => index_file }] |
This file contains 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
module ActiveSupport | |
module StringInquirerPatch | |
def self.included klass | |
klass.send :remove_method, :method_missing | |
end | |
def method_missing method_name, *arguments | |
if method_name.to_s[-1,1] == "?" | |
is_eql_to_self = (self == method_name.to_s[0..-2]) |
OlderNewer