Skip to content

Instantly share code, notes, and snippets.

View luizfonseca's full-sized avatar
💻
cargo run

Luiz Fonseca luizfonseca

💻
cargo run
View GitHub Profile
@luizfonseca
luizfonseca / Gemfile
Created July 22, 2011 04:12
Gemfile for Rails Apps
source 'http://rubygems.org'
# Updated Rails version
gem 'rails', '3.1.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# Server ('cause Webrick is such a pain in the ass)
gem 'unicorn'
@luizfonseca
luizfonseca / algorhythm.py
Created August 9, 2011 01:20
Google Developer Day (Python script)
#! /usr/bin/python
class ReadableGooglon:
vocabulary = list('wnzpkgrdqbfjlxvhcsmt')
foo_letters = list('vkcjq')
mapped = list('0123456789abcdefghij')
not_prep = 'l'
prep_length = 3
verb_length = 6 #greater than 6
base_pretty = 20
min_pretty_num = 404169
@luizfonseca
luizfonseca / rename.sh
Created August 16, 2011 09:31
Rename directory files from .erb to .haml (sample)
for file in *.erb; do mv $file `echo $file | sed 's/\(.*\.\)erb/\1haml/'`; done
@luizfonseca
luizfonseca / ButtonAction.java
Created December 23, 2011 15:31
Simple Java Clock app for testing the Observer pattern.
// PACKAGE GOES HERE <--------
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ButtonAction implements ActionListener {
private Clock clock = new Clock();
@Override
public void actionPerformed(ActionEvent e) {

Festival de Ideias

Setup

  • You should edit the database.sample.yml file, to your Postgres configuration.
  • You should create/migrate/seed the data.
  • You should run the test suite to assure everything is O.K.
@luizfonseca
luizfonseca / Clock.java
Created December 26, 2011 20:00
Another version of the Clock, still using the java.util.Observable
// Package :V
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.GregorianCalendar;
import java.util.Observable;
import javax.swing.Timer;
public class Clock extends Observable implements ActionListener {
@luizfonseca
luizfonseca / script.sh
Created January 13, 2012 07:44
Reseting a PostgreSQL database on Heroku
heroku pg:reset SHARED_DATABASE --confirm=_database_name_ && heroku rake db:migrate db:seed
@luizfonseca
luizfonseca / cssgrid.css.sass
Created April 17, 2012 14:07
CSSGRID.net Convertido para SASS e com possibilidade de aumentar/diminuir a margem entre cada coluna do grid.
$columns: 12
$margin: 1.8%
@function column-width($column)
@return ($column * ((100% / $columns) - $margin)) + (($column - 1) * $margin)
.container
padding-left: 20px
padding-right: 20px
resources :stats do
member :tickets do
member :details
end
end
@luizfonseca
luizfonseca / friendly.rb
Created May 4, 2012 03:07
Friendly Robots (somewhere in 2010?)
#!/usr/bin/env ruby
class FriendlyRobots
$num_test_case = nil
$test_case = Array.new
def get_num_test_case
puts "How fast can the robots complete the hallway?"
puts "Please, input the test case: (an integer value)"