I hereby claim:
- I am vroy on github.
- I am vroy (https://keybase.io/vroy) on keybase.
- I have a public key whose fingerprint is 7D82 60F2 2D92 C5F7 84DA D429 D86C 8DBD 307A FE90
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env ruby | |
# A simple utility to extract patterns out of input streams | |
# | |
# Heavily inspired by: | |
# http://jstorimer.com/2011/12/12/writing-ruby-scripts-that-respect-pipelines.html | |
# https://gist.github.com/jstorimer/1465437 | |
# | |
# Examples: | |
# |
require 'rubygems' | |
require 'sequel' | |
require 'time' | |
DB = Sequel.connect 'sqlite:/' | |
class Category < Sequel::Model | |
set_schema do | |
primary_key :id | |
text :name |
require "rubygems" | |
require 'sequel' | |
require "sinatra" | |
DB = Sequel.connect 'sqlite://blog.db' | |
class Post < Sequel::Model(:posts) | |
set_schema do | |
primary_key :id | |
varchar :title |
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:493:in `const_missing': uninitialized constant ActionView::Base::Haml (NameError) | |
from /usr/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/haml/helpers/action_view_mods.rb:20 | |
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' | |
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' | |
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:in `require' | |
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:355:in `new_constants_in' | |
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:in `require' | |
from /usr/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/haml/helpers.rb:1 | |
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' | |
... 15 levels... |
index.asdf |
class TrafficLight | |
def initialize | |
@colors = ["green", "yellow", "red"] | |
@index = 0 | |
end | |
def color | |
@colors[@index] | |
end | |
class Mysql | |
def proc(str) | |
DB.query_with_result = false | |
resultsets = [] | |
no_more_results=false | |
DB.query( %(call #{str}) ) |
I want a connection pool for mysql objects that I would use with the mysql C adapter and mysqlplus. But I was also looking to make it as flexible as possible so that it can be a pool of object for more than just mysql connections. I'm looking for advice on how to implement that, I currently have 2 implementations above. I read the sequel connection_pool.rb file but I don't understand everything so stripping the Sequel part is kind of a problem for me. Do you guys have any advice/opinion on how I could achieve this?
require 'rubygems' | |
require 'ramaze' | |
# Start this example with `ruby hello.rb`. | |
# After startup you will be able to access it at http://localhost:7000/ | |
# This should output "Hello, World!" in your browser. | |
class MainController < Ramaze::Controller | |
map '/' | |