Skip to content

Instantly share code, notes, and snippets.

View thiagomoretto's full-sized avatar

Thiago Moretto thiagomoretto

View GitHub Profile
@thiagomoretto
thiagomoretto / 0_reuse_code.js
Created January 7, 2014 11:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@thiagomoretto
thiagomoretto / inflections.rb
Created June 13, 2012 20:10 — forked from mateusg/inflections.rb
pt-BR inflections file for Ruby on Rails applications
# encoding: utf-8
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
@thiagomoretto
thiagomoretto / StringUtil.java
Created December 2, 2011 17:20 — forked from ar/StringUtil.java
String[] Encode/Decode (my attempt)
import java.util.*;
public class StringUtil {
public static String encode (String[] ss) {
StringBuilder sb = new StringBuilder();
for (String s : ss) {
if (sb.length() > 0)
sb.append(',');
if (s != null)
sb.append(s.replaceAll("\\\\", "\\\\\\\\")
@thiagomoretto
thiagomoretto / attr.rb
Created June 24, 2010 14:55 — forked from jm/attr.rb
class ClassWithAttr
def self.my_attr_accessor(attr_name)
define_method("#{attr_name}=") do |arg|
instance_variable_set("@#{attr_name}", arg)
end
define_method(attr_name) do
instance_variable_get("@#{attr_name}")
end
end