Skip to content

Instantly share code, notes, and snippets.

View thbar's full-sized avatar

Thibaut Barrère thbar

View GitHub Profile
Index: gems/rufus-google/lib/rufus/gcal.rb
===================================================================
--- gems/rufus-google/lib/rufus/gcal.rb (revision 722)
+++ gems/rufus-google/lib/rufus/gcal.rb (working copy)
@@ -110,7 +110,11 @@
def start_time
evalue('when', 'startTime', :time => true)
end
-
+
# you can grab mspec using:
# git clone git://github.com/jflam/mspec.git
$LOAD_PATH << File.dirname(__FILE__) + "/gems/mspec/lib"
require 'mspec'
describe "Array#sort" do
before :each do
@obj = [1,9,0,10]
{% quizz %}
{% question texte: Etes-vous d'accord ? %}
{% reponse texte: Pas du tout, poids: 0 %}
{% reponse texte: Plutôt, oui, poids: 2 %}
{% reponse texte: Tout à fait, poids: 4 %}
{% endquestion %}
...
@thbar
thbar / gist:39191
Created December 22, 2008 23:43
Extra "etl_execution" migrations for ActiveWarehouse-ETL
Index: vendor/activewarehouse-etl/lib/etl/execution/migration.rb
===================================================================
--- vendor/activewarehouse-etl/lib/etl/execution/migration.rb (revision 765)
+++ vendor/activewarehouse-etl/lib/etl/execution/migration.rb (working copy)
@@ -8,11 +8,17 @@
def migrate
connection.initialize_schema_information
v = connection.select_value("SELECT version FROM #{schema_info_table_name}").to_i
- v.upto(target - 1) do |i|
- __send__("migration_#{i+1}".to_sym)
Books I just bought from PragProgs:
===================================
Core Animation for Mac OS X and the iPhone
Desktop GIS
Enterprise Recipes with Ruby and Rails
Hello, Android
iPhone SDK Development
Mastering Dojo
Pragmatic Version Control Using Git
require 'active_record'
require 'action_view'
require 'will_paginate'
WillPaginate.enable
@thbar
thbar / activerecord-2.2.2-ramaze-patch.rb
Created December 29, 2008 16:40
Patch to use ActiveRecord 2.2.2 outside Rails
# patch to handle connection pooling outside of rails: http://www.williambharding.com/blog/rants/rails-22-connection-pools-mongrel-handlers-bloodbath/
# call ActiveRecord::Base.connection_handler.clear_connection! at the end of your requests (or as soon as you don't need AR anymore).
module ActiveRecord
module ConnectionAdapters
class ConnectionPool
def release_connection(conn_id = nil)
conn_id ||= current_connection_id
conn = @reserved_connections.delete(conn_id)
checkin conn if conn
end
# patch to handle connection pooling outside of rails: http://www.williambharding.com/blog/rants/rails-22-connection-pools-mongrel-handlers-bloodbath/
module ActiveRecord
module ConnectionAdapters
class ConnectionPool
def release_connection(conn_id = nil)
conn_id ||= current_connection_id
conn = @reserved_connections.delete(conn_id)
checkin conn if conn
end
end
Index: thinking-sphinx/lib/thinking_sphinx/attribute.rb
===================================================================
--- thinking-sphinx/lib/thinking_sphinx/attribute.rb (revision 809)
+++ thinking-sphinx/lib/thinking_sphinx/attribute.rb (working copy)
@@ -102,14 +102,17 @@
end
def type_to_config
- {
+ supported_types = {
#!/usr/local/bin/ruby
# inspired by http://ariejan.net/2009/01/04/how-to-start-a-rails-edge-app-the-easy-way/
require 'fileutils'
def launch(cmd); puts cmd; throw "Error!" unless system(cmd); end
def bye(message); puts message; exit -1; end
bye "Syntax: my_rails app_name" unless (app_name = ARGV.first)
bye "Folder #{app_name} already there! Remove it first." if File.exists?(app_name)