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 | |
# | |
# PROVIDE: cccms | |
# REQUIRE: nginx cleanvar | |
. /etc/rc.subr | |
name=cccms | |
rcvar=`set_rcvar` |
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
Output root of a given branch (second commit from the top of the output) | |
git for-each-ref refs/heads | while read sha rest; do git merge-base $sha <branchname>; done | git log --date-order --no-walk --stdin |
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
ruby-1.8.7-p249 > posts = Post.all | |
Post Load (0.4ms) SELECT * FROM "posts" | |
Post::Translation Load (0.4ms) SELECT * FROM "post_translations" WHERE ("post_translations"."locale" IN ('en')) AND ("post_translations".post_id = 1) | |
Post::Translation Load (0.3ms) SELECT * FROM "post_translations" WHERE ("post_translations"."locale" IN ('en')) AND ("post_translations".post_id = 1) | |
Post::Translation Load (0.3ms) SELECT * FROM "post_translations" WHERE ("post_translations"."locale" IN ('en')) AND ("post_translations".post_id = 1) | |
Post::Translation Load (0.3ms) SELECT * FROM "post_translations" WHERE ("post_translations"."locale" IN ('en')) AND ("post_translations".post_id = 1) | |
Post::Translation Load (0.3ms) SELECT * FROM "post_translations" WHERE ("post_translations"."locale" IN ('en')) AND ("post_translations".post_id = 2) | |
Post::Translation Load (0.3ms) SELECT * FROM "post_translations" WHERE ("post_translations"."locale" IN ('en')) AND ("post_translations".post_id = 2) | |
+----+-------- |
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
class CrazyHash < Hash | |
def initialize init_hash | |
super.merge! init_hash | |
end | |
def to_s | |
"do something different and important so the literal {} wont work" | |
end | |
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
# Install SQLite3 with FTS3 | |
1. cd /opt/local/var/macports/sources/rsync.macports.org/release/ports/databases/sqlite3/ | |
2. vi Portfile | |
3. add -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS to configure.cppflags |
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
[hukl@eight /Volumes/Data/Source]$ git clone http://github.com/luislavena/sqlite3-ruby.git | |
Cloning into sqlite3-ruby... | |
remote: Counting objects: 1957, done. | |
remote: Compressing objects: 100% (677/677), done. | |
remote: Total 1957 (delta 1220), reused 1854 (delta 1140) | |
Receiving objects: 100% (1957/1957), 308.04 KiB | 162 KiB/s, done. | |
Resolving deltas: 100% (1220/1220), done. | |
[hukl@eight /Volumes/Data/Source]$ cd sqlite3-ruby/ | |
[hukl@eight /Volumes/Data/Source/sqlite3-ruby:master]$ ruby setup.rb config | |
---> lib |
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
source :rubygems | |
gem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git" |
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 'openssl' | |
require 'socket' | |
header = <<HEADER | |
GET / HTTP/1.1 | |
Host: example.com | |
Origin: localhost | |
Content-Length: 0 | |
Content-Type: text/plain | |
Connection: close\r\n\r\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
require 'async_sinatra' | |
class App < Sinatra::Base | |
register Sinatra::Async | |
aget '/' do | |
timed_out = false | |
timeout = EM::Timer.new(7) do | |
timed_out = true |
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 'async_sinatra' | |
class App < Sinatra::Base | |
register Sinatra::Async | |
@next_id = 0 | |
def self.next_id | |
@next_id += 1 | |
end |