Skip to content

Instantly share code, notes, and snippets.

View pedrobrasileiro's full-sized avatar
💭
I may be slow to respond.

Pedro Brasileiro pedrobrasileiro

💭
I may be slow to respond.
View GitHub Profile
#----------------------------------------------------------------------------
# Git Setup
#----------------------------------------------------------------------------
file '.gitignore', <<-FILE
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
public/uploads/*
$ autotest
loading autotest/rails_rspec2
style: RailsRspec2
--------------------------------------------------------------------------------
/Users/dchelimsky/.rvm/rubies/ruby-1.8.7-p249/bin/ruby -rrubygems /Users/dchelimsky/.rvm/gems/ruby-1.8.7-p249/gems/rspec-core-2.0.0.beta.6/bin/rspec /Users/dchelimsky/tmp/example/spec/models/widget_spec.rb /Users/dchelimsky/tmp/example/spec/views/widgets/show.html.erb_spec.rb /Users/dchelimsky/tmp/example/spec/views/widgets/edit.html.erb_spec.rb /Users/dchelimsky/tmp/example/spec/views/widgets/new.html.erb_spec.rb /Users/dchelimsky/tmp/example/spec/controllers/widgets_controller_spec.rb /Users/dchelimsky/tmp/example/spec/views/widgets/index.html.erb_spec.rb
*...................
module Multiprocess
def self.start num_thread, list
unless block_given?
Servico::Log.andamento_monitor "Nenhum bloco foi passado"
return false
end
# Pra cada elemento do list passado, quero executar o yield passando esse elemento pra ele.
list.each {|i| ???}
end
# -*- coding: utf-8 -*-
Savon::Client.class_eval do
# Retorna nil caso não consiga comunicação
def get_hash_body method, params={}
begin
retorno = nil
resp = "#{method.to_s}_response".to_sym
ret = "#{method.to_s}_return".to_sym
@pedrobrasileiro
pedrobrasileiro / gist:2040807
Created March 15, 2012 00:51
Correct Whitespace
# encoding: utf-8
ActiveRecord::Base.transaction do
entity = Entity.create!(:name => "Entidade Teste")
["Comum", "Adiantamento", "Subvenção Social", "Auxilio",
"Contribuição", "Convênios", "Outras Antecipações"].each do |description|
PledgeHistoric.create!(:description => description,
:entity_id => entity.id,
:year => Date.current.year,
:source => Source::DEFAULT)
@pedrobrasileiro
pedrobrasileiro / gist:2353106
Created April 10, 2012 17:33
Sample Hide Keyboard
var nameField = Ti.UI.createTextField({});
//iOS
nameField.addEventListener('blur', function(e) {
???
});
//Android
nameField.addEventListener('blur', function(e) {
Ti.UI.Android.hideSoftKeyboard();
@pedrobrasileiro
pedrobrasileiro / inflections.rb
Created September 3, 2012 20:11 — 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 )
@pedrobrasileiro
pedrobrasileiro / gist:3998899
Created November 2, 2012 05:27
TextMate 2 .tm_properties

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

@pedrobrasileiro
pedrobrasileiro / index.xml
Created December 17, 2012 18:25
index.xml
<Alloy>
<Window class="container">
<Widget src="br.com.teste.header" id="header"/>
<View id="view_login">
<TextField id="tfLogin" class="textFieldLogin" hintText="Login" top="30"/>
<TextField id="tfPassword" class="textFieldLogin" hintText="Password" passwordMask="true"/>
<Button class="buttonOk" onClick="login">Entrar</Button>
<ActivityIndicator id="activity_login" />
</View>
<Widget src="br.com.teste.footer" id="footer"/>
@pedrobrasileiro
pedrobrasileiro / index.jss
Created December 17, 2012 18:25
index.jss
".container" : {
backgroundImage : '/images/telas/bg_geral.png',
backgroundRepeat : true,
exitOnClose : true
},
".textFieldLogin" : {
top : '10dp',
left : '10dp',
right : '10dp',