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
From bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001 | |
From: Ilya Grigorik <[email protected]> | |
Date: Thu, 10 Jun 2010 00:46:48 -0400 | |
Subject: [PATCH] async rails3 | |
--- | |
Gemfile | 6 ++++++ | |
app/controllers/widgets_controller.rb | 6 ++++++ | |
app/models/widget.rb | 2 ++ | |
config.ru | 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
# rubygems DNS is temporarily down, put this into your /etc/hosts to install gems, | |
# but don't forget to remove the entries once their DNS is back up again | |
72.4.120.124 rubygems.org | |
207.171.181.231 production.s3.rubygems.org | |
216.137.45.24 production.cf.rubygems.org |
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
import re | |
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone | |
from metaphone import dm as double_metaphone | |
# get the Redis connection | |
from jellybean.core import redis | |
import models | |
# Words which should not be indexed |
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 'sinatra' | |
require 'redis' | |
# To use, simply start your Redis server and boot this | |
# example app with: | |
# ruby example_note_keeping_app.rb | |
# | |
# Point your browser to http://localhost:4567 and enjoy! | |
# |
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 | |
# run with: curl -s http://gist.github.com/265272.txt | bash | |
set -e | |
localdir=$HOME/.mongodb | |
datadir=$localdir/data | |
conf=$localdir/mongod.conf | |
agentdir=$HOME/Library/LaunchAgents | |
agent=$agentdir/org.mongodb.mongod.plist |
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 Integer | |
def prime? | |
!("1" * self).match(/^1?$|^(11+?)\1+$/).nil? | |
end | |
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
gemcutter => redis downloads spec | |
================================= | |
keys | |
---- | |
downloads => global counter for all gem downloads | |
downloads:today => sorted set for downloads from today | |
downloads:rubygem:rails => counter for all rails downloads | |
downloads:version:rails-2.3.5 => counter for all rails 2.3.5 downloads |
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/env ruby | |
%w(rubygems open-uri nokogiri).each { |lib| require lib} | |
doc = Nokogiri::HTML(open('http://xkcd.com/').read) | |
img = doc.at_css("#middleContent img") | |
puts %|Content-type: text/html | |
<html> | |
<head> |
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
An exception occurred running /Users/stan/.rvm/gems/rbx-1.0.0-rc5/bin/unicorn | |
assertion failed: current_unwind < kMaxUnwindInfos (Rubinius::Internal) | |
Backtrace: | |
An exception occurred running /Users/stan/.rvm/gems/rbx-1.0.0-rc5/bin/unicorn | |
assertion failed: current_unwind < kMaxUnwindInfos (Rubinius::Internal) | |
Backtrace: | |
ESC[0;31m Unicorn::HttpServer#worker_loop at /Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn.rb:698ESC[0m | |
Unicorn::HttpServer#spawn_missing_workers {} at /Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn.rb:605ESC[0m |
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
not sure where it starts/ends. was looping this: | |
[2010-05-14T09:56:45.466816 #27335] INFO -- : worker=0 spawning... | |
[2010-05-14T09:56:45.467432 #27335] ERROR -- : Unhandled master loop exception #<Errno::EAGAIN: Resource temporarily unavailable - fork(2) failed>. | |
[2010-05-14T09:56:45.467432 #27978] ERROR -- : kernel/common/process.rb:58:in `fork' | |
kernel/common/process.rb:601:in `fork' | |
/Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn.rb:602:in `spawn_missing_workers {}' | |
kernel/common/range.rb:162:in `each' | |
/Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn.rb:598:in `spawn_missing_workers' | |
/Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn.rb:611:in `maintain_worker_count' |