Skip to content

Instantly share code, notes, and snippets.

View main.rb
# threads dying on fork examples. run with:
# ruby main.rb
# or
# ruby main.rb fork
require 'thread'
class Worker
def initialize
@thread = { work }
felipeelias / genetic.rb
Created Mar 30, 2018
Genetic algorithm
View genetic.rb
class Chromosome
SIZE = 10
attr_reader :value
def initialize(value)
@value = value
def fitness
require "ecr"
class Greeting
# def wrap(tag)
# do |str|
# str << "<#{tag}>"
# str << yield
# str << "</#{tag}>"
# end
# end
felipeelias /
Last active Apr 14, 2017
References of various topics

Keybase proof

I hereby claim:

  • I am felipeelias on github.
  • I am felipeelias ( on keybase.
  • I have a public key ASCXvgXFgRDO3gzYvfR9Q2V2K9pra4RL5kv-r8M3EoKmfQo

To claim this, I am signing this object:

felipeelias / pubsub.ex
Last active Mar 24, 2016
PubSub server
View pubsub.ex
defmodule Pubsub do
use Application
def start(_type, _options) do
import Supervisor.Spec
IO.puts("Initializing Pubsub app on #{inspect self}")
children = [
worker(Pubsub.Server, [], [name: :server_supervisor])
View daily_walk.go
package main
import (
var wg sync.WaitGroup
LaundryMachine washer = getLaundryMachine();;
List<Unerdwear> pileOfUnerdwear = gatherUnerdwear();
for (Unerdwear underwear : pileOfUnerdwear) {
if (underwear.isDirty() OR underwear.isSticky()) {
} else {
while (undewear.isntDirty()) {
felipeelias / spec_helper.rb
Last active Dec 10, 2015
Simple 'database cleaner' approach using `config.around`. Was able to cut down some seconds out of the suite. Thanks to @brandonhilkert
View spec_helper.rb
RSpec.configure do |config|
config.around do |example|
# For examples using capybara-webkit for example.
# Remove this if you don't use it or anything similar
if example.metadata[:js]
ActiveRecord::Base.connection.execute("TRUNCATE #{ActiveRecord::Base.connection.tables.join(',')} RESTART IDENTITY")
ActiveRecord::Base.transaction do
felipeelias /
Created Oct 27, 2011
Deploy with git's post-receive hook
# Production environment
export RAILS_ENV="production"
export PATH="/opt/ruby/bin:$PATH"
exit_with_error() {