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 'active_record' | |
require 'benchmark/ips' | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'sqlite3', | |
:database => ':memory:') | |
ActiveRecord::Base.connection.create_table('posts') do |t| | |
t.string :name | |
t.timestamps |
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
group :assets do | |
#gem 'sass-rails', '~> 3.1.4' | |
#gem 'coffee-rails', '~> 3.1.1' | |
#gem 'uglifier', '>= 1.0.3' | |
gem 'less', :git => 'git://github.com/kares/less.rb.git', :submodules => true | |
gem 'less-rails', '>= 2.2.1' | |
gem 'less-rails-bootstrap' # optional | |
gem 'therubyracer', :platforms => :ruby |
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 | |
ssh-add | |
ssh $1 "mkdir -p .ssh && touch .ssh/authorized_keys && echo `ssh-add -L` >> .ssh/authorized_keys" | |
# keep this file in the PATH. like in /usr/bin. |
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
web: node app.js | |
worker: node consumer.js |
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
$ jruby --server is_prime.rb | |
"jruby 1.7.0.dev (ruby-1.8.7-p330) (2011-09-23 2b786ba) (Java HotSpot(TM) Server VM 1.6.0_26) [darwin-i386-java]" | |
user system total real | |
100K primes 8.003000 0.000000 8.003000 ( 7.967000) | |
user system total real | |
100K primes 7.742000 0.000000 7.742000 ( 7.742000) | |
user system total real | |
100K primes 7.950000 0.000000 7.950000 ( 7.950000) | |
user system total real | |
100K primes 7.977000 0.000000 7.977000 ( 7.977000) |
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
;; Add this to ~/.emacs | |
;; Missing from ruby-mode.el, see https://groups.google.com/group/emacs-on-rails/msg/565fba8263233c28 | |
(defun ruby-insert-end () | |
"Insert \"end\" at point and reindent current line." | |
(interactive) | |
(insert "end") | |
(ruby-indent-line t) | |
(end-of-line)) |
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
(ns demo.gemstoclojure | |
(:use ring.adapter.jetty) | |
(:use clojure.contrib.io) | |
(:use clojure.contrib.classpath)) | |
(import '(org.jruby.embed ScriptingContainer LocalContextScope)) | |
(def c (ScriptingContainer. LocalContextScope/THREADSAFE)) | |
(println (classpath)) | |
(println (pwd)) |
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
:~$ rvm use jruby | |
Using /home/saito/.rvm/gems/jruby-1.6.2 | |
:~$ gem i mvn:org.slf4j:slf4j-simple | |
Successfully installed mvn:org.slf4j:slf4j-api-1.6.2-java | |
Successfully installed mvn:org.slf4j:slf4j-simple-1.6.2-java |
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
# Rails 3 Config | |
# | |
# In: config/application.yml | |
# | |
# development: | |
# github: | |
# key: test | |
# secret: verysecret-dev | |
# production: | |
# github: |
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
$pid = fork | |
if $pid == nil | |
exec "./srvd/redis-server ./srvd/redis.conf" | |
end | |
sleep 5 | |
Process.kill(:$pid) |