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 / 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
@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 / 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 {

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 / 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) {
@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 / 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 / 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 / sample.erb
Created July 21, 2011 17:18
Better loading of styles on a Rails Application :-)
%h1 When using HAML, or even the rails .erb format, you can improve the loading of your pages using:
= stylesheet_link_tag controller.action_name
%span Or
= stylesheet_link_tag self.current_method
%span And create the proper CSS file in the public/style folder (e.g.: action_name.(s)css/ current_method.(s)css.
With this, the user only requests the CSS file from that page he is visiting.
@luizfonseca
luizfonseca / elland.html
Created June 30, 2011 15:56
Sample birthday something
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>MIA</title>
<style type="text/css" media="screen">
* { padding: 0; margin: 0; font: normal 19px/20px "Georgia", Times New Roman, serif; color: #b5671e; }
body { background: #F9667A; }
#wrapper { width: 90%; background: #916F4F; margin: 30px auto; overflow: hidden; }
.column { float: left; width: 200px; height: auto; padding: 10px; margin: 20px 10px; background: #fbdcdc; }