Skip to content

Instantly share code, notes, and snippets.

View fphilipe's full-sized avatar
🌍
🎶 around the world 🕺🎶

Philipe Fatio fphilipe

🌍
🎶 around the world 🕺🎶
View GitHub Profile
desc "A Task watched by Exceptional"
task :do_something => :environment do
Exceptional.rescue('Error doing something') do
# do something
end
end
#!/bin/sh
#### CONFIG ################################
USE_OLD_ICON=true # replace the new simplified icon with the old one
APP_DESTINATION=/Applications/Chromium.app # where to put the app
SUPPORT_DIR="`dirname "$0"`/.support" # where the icon and version number will be stored
############################################
VERSION_FILE="$SUPPORT_DIR/chromium_version"
NEWEST_VERSION=`curl -s http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE`
@solnic
solnic / active-model-validations-vs-dry-validation.txt
Last active December 7, 2015 20:12
ActiveModel/ActionController::Parameters vs Dry::Validation::Schema
Calculating -------------------------------------
ActiveModel::Validations
134.000 i/100ms
dry-validation 2.145k i/100ms
-------------------------------------------------
ActiveModel::Validations
1.499k (±11.5%) i/s - 7.504k
dry-validation 22.300k (±10.5%) i/s - 111.540k
Comparison:
@mbj
mbj / names.txt
Last active December 17, 2015 11:09
DM2 names We need a name to solve dm1 and dm2 namespace clash proactively
* rom (ruby-object-mapper)
* rohm
* rome (easier to pronounce)
* resistance
* bloom
* allure
* agrabla (esperanto) agreeable, enjoyable, lovely, nice, pleasant
* vigor (power, energy)
* moxie (courage)
* "mowr" (pronounced "mower", meaning nothing i can think of, except: "mapping objects with ruby")
struct Complex<T: FloatLiteralConvertible> {
var real: T
var imaginary: T
}
func +(lhs: Complex<Double>, rhs: Complex<Double>) -> Complex<Double> {
return Complex<Double>(real: lhs.real + rhs.real, imaginary: lhs.imaginary + rhs.imaginary)
}
@jamiehodge
jamiehodge / resource.rb
Last active November 28, 2017 23:23
Server Side Events, Sequel and Postgres LISTEN/NOTIFY
require 'sequel'
DB ||= Sequel.connect ENV['DATABASE_URL']
class Resource < Sequel::Model
include Sequel.inflections
def after_save
db.notify channel
end
@svenfuchs
svenfuchs / README.md
Created March 19, 2012 00:45
minimal activerecord standalone migrations

In your Gemfile add:

group :development, :test do
  gem 'micro_migrations', :git => 'git@gist.github.com:33e9f92c229eb808a4fa.git'
end

You might want to add something like this to the Rakefile of apps that use a gem that uses micro_migrations:

ENV['SCHEMA'] = "#{Gem.loaded_specs['your-gem-name'].full_gem_path}/db/schema.rb"

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import Darwin
extension Int {
static func random() -> Int {
return Int(arc4random())
}
static func random(range: Range<Int>) -> Int {
return Int(arc4random_uniform(UInt32(range.endIndex - range.startIndex))) + range.startIndex
}
@eric1234
eric1234 / 0_instructions.txt
Created April 9, 2011 01:12
Using Sprockets 2 in Rails 3.0.x with CoffeeScript & SASS
UPDATE: Please see some of the forks for an updated version of this guide. I
myself have moved onto the Rails 3.1 betas to get the asset pipeline. But if
you want to stay on stable there are other folks who are keeping this guide
relevant despite the changes constantly occurring on Sprockets 2. The comments
on this gist will lead you to the right forks. :)
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript
powered JS and SASS powered CSS with YUI compression all via the magic of rack.
This stuff will be native in Rails 3.1 and the layout of the files on the