lg2046 lg2046

View gist:2183474

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

View 0-readme.md

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

View nginx.conf
1 2 3 4 5 6 7 8 9 10
# Config for Nginx to act as a front-end for Riak
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc)
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_)
 
# Config is in /etc/nginx/sites-available/default or somewhere like that
 
# Set up load-balancing to send requests to all nodes in the Riak cluster
# Replace these IPs/ports with the locations of your Riak nodes
upstream riak_hosts {
server 127.0.0.1:8098;
View Gemfile-rails-2.3.8.rb
1 2 3 4 5 6 7 8 9 10
# Everything you need to do to get started with Rails 2.3.8
#
# As of June 14th, 2010 @ 2:30 p.m. MST
#
# This gist now features instructions to get Rails 3 up and running with:
# - Ruby 1.8.7-p174
# - Bundler 0.9.26
# - Cucumber 0.8.0
# - Rspec 1.3.0 + Rspec-Rails 1.3.2
# - RVM
View flex service server
1 2 3 4 5 6 7 8 9 10
require "socket"
 
PORT = 843
 
server = TCPServer.open(PORT)
puts "the policy server is start..."
 
while (session = server.accept)
puts "ye.."
session.puts "<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"sub.app.test\" to-ports=\"61613\"/></cross-domain-policy>\000"
View gist:103827
1 2 3 4 5 6 7 8 9 10
require "rubygems"
require "active_record"
# Connection pool logic works, but the underlying driver
# is still blocking. However, aliasing the query method
# to use mysqlplus produces expected results!
require 'mysqlplus'
class Mysql; alias :query :async_query; end
ActiveRecord::Base.establish_connection(
View quick mysql plus
1 2 3 4 5 6 7 8 9 10
require "rubygems"
require 'active_record'
require 'mysqlplus'
class Mysql; alias :query :async_query; end
 
class DBConn < ActiveRecord::Base
establish_connection(
:adapter => "mysql",
:database => "test",
:username => "root",
View AR insert quick
1 2 3 4 5 6 7 8 9 10
require "rubygems"
require 'active_record'
 
class DBConn < ActiveRecord::Base
establish_connection(
:adapter => "mysql",
:database => "test",
:username => "root",
:password => "123",
:host => "localhost"
View migration outside rails
1 2 3 4 5 6 7 8 9 10
require "rubygems"
require 'active_record'
 
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:database => "test",
:username => "root",
:password => "123",
:host => "localhost"
)
View youtube test
1 2 3 4 5
require "rubygems"
require 'youtube_g'
 
client = YouTubeG::Client.new
client.videos_by(:user => 'liz')
Something went wrong with that request. Please try again.