Skip to content

Instantly share code, notes, and snippets.

View lgs's full-sized avatar

Luca G. Soave lgs

View GitHub Profile
This example shows how to setup an environment running Rails 3 beta under 1.9.2-head with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell)) or do 'rvm reload'
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.2-head
# Switch to 1.9.2-head and gemset rails3, create if it doesn't exist.
∴ rvm --create use 1.9.2-head@rails3
# checkout: http://github.com/igrigorik/async-rails/
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 ++++++
@lgs
lgs / gist:454191
Created June 26, 2010 17:10 — forked from qrush/gist:273075
diff --git a/lib/integrity/builder.rb b/lib/integrity/builder.rb
index 6968d9e..691ff70 100644
--- a/lib/integrity/builder.rb
+++ b/lib/integrity/builder.rb
@@ -46,7 +46,8 @@ module Integrity
end
def run
- cmd = "(cd #{repo.directory} && #{@build.project.command} 2>&1)"
+ cmd = "(cd #{repo.directory} && RUBYOPT=#{pre_bundler_rubyopt} PATH=#{pre_bundler_path} && #{@build.project.command} 2>&1)"
@lgs
lgs / oshi.rb
Created July 18, 2010 16:51 — forked from anonymous/oshi.rb
require 'rubygems'
require 'eventmachine'
require 'em-websocket'
require 'json'
class Connection
attr_accessor :socket, :user_id
def initialize(socket, user_id)
@socket = socket
#!/usr/bin/env ruby
require 'benchmark'
require 'rubygems'
require 'nokogiri'
require 'yajl'
require 'active_support'
ActiveSupport::XmlMini.backend='Nokogiri'
require 'active_resource'
# http://snippets.aktagon.com/snippets/445-How-to-create-a-JSONP-cross-domain-webservice-with-Sinatra-and-Ruby
require 'sinatra/base'
require 'json/pure'
module JSONPatra
class App < Sinatra::Base
get "/" do
callback = params['callback']
json = { :hello => "world!" }.to_json
@lgs
lgs / example.rb
Created September 14, 2010 10:08 — forked from nesquena/example.rb
class SampleApp < Padrino::Application
register Padrino::Warden
Warden::Strategies.add(:password) do
def valid?
params["email"] || params["password"]
end
def authenticate!
u = Account.authenticate(params["email"], params["password"])
@lgs
lgs / gist:590594
Created September 21, 2010 21:27 — forked from imathis/gist:590559
// Create a simple top to bottom linear gradient with a background-color backup
// The first argument, $color will be output as background-color: $color
//
// This yields a gradient that is 5% brighter on the top and 5% darker on the bottom
//
// +gradient-bg(#777)
//
// This yeilds a gradient where the bright and dark colors are shifted 10% from the original color.
// If you don't specify a third argument it will assign this value for the darkness too, keeping the gradient even.
//
#
# Wind Wordpress Importer
#
# To install this plugin do you need copy the file to Wind plugins directory.
# An admin widget will be crated to import WordPress eXtended RSS file.
#
# This plugin use hurricane gem [http://github.com/danieltamiosso/hurricane],
# [gem install hurricane] to install it.
#
mkdir wpgskeeter
cd wpgskeeter
git init
heroku create wpgskeeter
git add .
git commit -m 'Initial commit'
Create a .gems file:
sinatra
nokogiri