Skip to content

Instantly share code, notes, and snippets.

View guipdutra's full-sized avatar

Guilherme Dutra guipdutra

View GitHub Profile
@guipdutra
guipdutra / robot.js
Created December 4, 2012 17:10
Guip
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@guipdutra
guipdutra / robot.js
Created December 4, 2012 17:10
Guip
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
class Aluno
def initialize(nota)
@nota = nota
end
def esta(selector)
selector.call(@nota)
end
@guipdutra
guipdutra / capybara cheat sheet
Created February 28, 2013 18:11 — forked from zhengjia/capybara cheat sheet
Capybara reference
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@guipdutra
guipdutra / gist:5272679
Last active February 11, 2022 15:41
Installing Phantom JS 1.9.0 on Ubuntu 32bit or 64bit.
For 32-bit system
use phantomjs-1.9.0-linux-i686.tar.bz2
For 64-bit system
use phantomjs-1.9.0-linux-x86_64.tar.bz2
Go to the SHARE directory
cd /usr/local/share
@guipdutra
guipdutra / gist:5322921
Created April 5, 2013 21:48
runnig blueprints e factory girl no console
require 'machinist/caching/active_record'
Dir[Rails.root.join("spec/blueprints/**/*.rb")].each {|f| require f}
require "#{Rails.root}/spec/support/preloadable_factories"
require "#{Rails.root}/spec/support/factories"
FactoryGirl::Preload.run
@guipdutra
guipdutra / gist:5341767
Created April 9, 2013 00:09
git log pretty format
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
@guipdutra
guipdutra / gist:5362819
Created April 11, 2013 11:59
Mapping for key to VIM refactoring
Extract to Method: Hit your <leader-key> then type rem
Rename Instance Variable: Hit your <leader-key> then type rriv
Rename Local Variable: Hit your <leader-key> then type rrlv
Extract Local Variable: relv
Extract to Let: Hit your <leader-key> then type rel
Extract Constant: Hit your <leader-key> then type rec
Convert Post Conditional: Hit your <leader-key> then type rcpc
Inline Temp: Hit your <leader-key> then type rit
Add Parameter: Hit your <leader-key> then type rap
<script type="text/javascript">
function loadCapabilityFromBudgetAllocation(event, budget_allocation) {
if (budget_allocation) {
var capabilities = budget_allocation.capabilities;
if (capabilities.length == 1) {
$(this).closest('.nested-extra_credit_moviment_types').find('.capability').val(capabilities[0].description);
$(this).closest('.nested-extra_credit_moviment_types').find('.capability').next('input').val(capabilities[0].id);
$(this).closest('.nested-extra_credit_moviment_types').find('.capability').attr('disabled','disabled');
# encoding: utf-8
class TaxRevenueGroupedBuilder
attr_accessor :retentions
attr_writer :tax_revenue, :tax_revenue_issued_status, :tax_revenue_receipt,
:tax_revenue_receipt_issued_status
def initialize(retentions)
self.retentions = retentions
end