Skip to content

Instantly share code, notes, and snippets.

View adimircolen's full-sized avatar

Adimir Colen adimircolen

View GitHub Profile
require 'rubygems'
require 'eventmachine'
##require 'lib/environment' # here we go again!
EM.kqueue = true if EM.kqueue? # file watching requires kqueue on OSX
class Example < EM::Connection
def receive_data(data)
#BlockConn.fila.size+1
Example.queue.push "#{data}"
# Ruby 1.9
require 'rubygems'
require 'eventmachine'
##require 'lib/environment' # here we go again!
##require 'sequel'
EM.kqueue = true if EM.kqueue? # file watching requires kqueue on OSX
module Example < EM::Connection
def receive_data(data)
@adimircolen
adimircolen / customer.rb
Created May 6, 2011 20:16
validates_associated
class Customer < ActiveRecord::Base
has_many :projects
validates :name, :presence => true
validates :cnpj, :presence => true, :format => { :with => /^\d{2}.?(\d{3}.?){2}\/\d{4}-?\d{2}$/ }
end
#!/usr/bin/env ruby
git_bundles = [
"git://github.com/astashov/vim-ruby-debugger.git",
"git://github.com/msanders/snipmate.vim.git",
"git://github.com/scrooloose/nerdtree.git",
"git://github.com/scrooloose/syntastic.git",
"git://github.com/timcharper/textile.vim.git",
"git://github.com/tpope/vim-cucumber.git",
"git://github.com/tpope/vim-fugitive.git",
@adimircolen
adimircolen / aws_cf_invalidate.rb
Created November 22, 2011 22:20 — forked from objectoriented/aws_cf_invalidate.rb
Ruby script to invalidate objects on Amazon's CloudFront CDN (shows status of recent requests also)
require 'rubygems'
require 'hmac-sha1' # on OS X: sudo gem install ruby-hmac
require 'net/https'
require 'base64'
#
# CHANGE ME: S3 access credentials go here, along with CloudFront Distribution ID
#
s3_access=''
s3_secret=''
#!/usr/local/bin/ruby
#
# Keeps backups for odrible for the last 7 days
#
# Assumes backups are stored in the dir referenced by the
# constant BACKUP_DIR.
#
# Assumes backup file names are in the formats '20101217002634.mysql-backup-sftp-odrible2.sql.gz.enc'
require 'date'
@adimircolen
adimircolen / .recipe
Created October 11, 2012 12:02 — forked from sowawa/.recipe
Installing rails 4.0.0 beta
thumbnail: http://pds.exblog.jp/pds/1/201101/16/02/d0055302_13383029.jpg
video: http://www.youtube.com/watch?v=UE27t_LJpx0
#!/usr/bin/env ruby
require 'gosu' # gem install gosu --no-document
include Gosu
$dimension, $splits = 200, 20
$size = $dimension.to_f / $splits.to_f
class Worm
attr_writer :dir
def initialize() reset end
## Rvm
.ruby-gemset
lib/config/env/development.js
## MacVim
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
gem: --no-ri --no-rdoc