Skip to content

Instantly share code, notes, and snippets.


Felipe Rodrigues felipero

View GitHub Profile
View array_tools.rb
class ArrayTools
def self.flat_array(array = [])
array.each_with_object([]) do |item, flat_array|
next if item.kind_of? String
flat_array.push *(item.kind_of?(Array) ? flat_array(item) : item)
felipero / short-version.rb
Last active Sep 11, 2017
Crafters Behavior For Team Member
View short-version.rb
while true
# ...
faça um comentário no cartão com link para o PR
mova o cartão para a coluna `PR Ready`
while ninguém revisou seu código
while seu PR não foi aprovado
while você não está satisfeito com o seu trabalho
View README.markdown

This is a fork of a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

  • Ability to disable autoselect of first matched element.
  • Ability to automatically set the width of the dropdown to that of the text input.
  • Ability to fetch source element via AJAX
  • Ability to have a comma separated list of tags.

For the proper source, and other examples, please see the original gist.

Example showing off all the above features

felipero / gist:1084997
Created Jul 15, 2011 — forked from juanplopes/gist:1084911
Sugestão de refactoring
View gist:1084997
# adapter =
# request =, card)
# transaction = request.execute_at!(adapter)
module Integration
class Transaction
def initialize(data)
@data = data
felipero / transaction.rb
Created Jul 15, 2011
Bad Single Responsibility Principle Example
View transaction.rb
module Integration
class Transaction
def initialize
@connection =
def create!(registration, card)
message = xml_builder("requisicao-transacao") do |xml|
xml.valor registration.training_class.price.to_i * 100
xml.moeda "986"
felipero / gist:765578
Created Jan 4, 2011
NHibernate Helper ninja fodastico
View gist:765578
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FluentNHibernate;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Context;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
View gist:343673
# 1) Point * in your DNS setup to your server.
# 2) Setup an Apache vhost to catch the star pointer:
# <VirtualHost *:80>
# ServerName
# ServerAlias *
# </VirtualHost>
# 3) Set the current account from the subdomain
View gist:342700
def self.get_top_picks(domain, type, category, level, page = 1)
results = SearchableListing.category(, level).by_type(type).
ids = results.collect(&:listing_id).uniq
results = Listing.find(ids, :order => ids.to_id_sql_order, :include => :user)
results.reject! { |l| l.get_availability == AdvisorStatus::Status::AWAY || l.user.busy_on_call? }
View gist:341503
def remote_setup
if branch.eql? "master"
checkout = ""
checkout = "&& $(git branch | grep -vq #{branch}) && git checkout -f -b #{branch} origin/#{branch}"
remote_run "cd #{path} && #{@sudo}git clone --depth 1 #{repository} #{application} && cd #{application} #{checkout}"
remote_run "#{@sudo}rake inploy:setup environment=#{environment}"
View gist:341343
[master] felipe:/workspaces/wave20/sehabitat$ rake inploy:remote:setup
(in /data/workspaces/wave20/sehabitat)
Inploy => ssh 'cd /srv/sehabitat && git clone --depth 1 release && cd release && rake inploy:local:setup environment=production''s password:
Initialized empty Git repository in /srv/sehabitat/release/.git/
rake aborted!
Could not find gem 'mysql (>= 0, runtime)' in any of the sources.
/srv/sehabitat/release/Rakefile:4:in `require'
(See full trace by running task with --trace)
(in /srv/sehabitat/release)
You can’t perform that action at this time.