Skip to content

Instantly share code, notes, and snippets.

View adilsoncarvalho's full-sized avatar

Adilson Carvalho adilsoncarvalho

View GitHub Profile
cd /tmp
git clone git://git.kernel.org/pub/scm/git/git.git
cd git
git checkout v`git --version | awk '{print $3}'`
cp contrib/completion/git-completion.bash ~/.git-completion.bash
cd ~
rm -rf /tmp/git
echo -e "source ~/.git-completion.bash" >> .profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=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')
import System.Linq.Enumerable
words = ("blueberry", "chimpanzee", "abacus", "banana", "apple", "cheese")
wordGroups = words.GroupBy({ w | w[0] })
for g in wordGroups:
print "Words that start with the letter $(g.Key):"
for word in g: print "\t$word"
@adilsoncarvalho
adilsoncarvalho / git-mergetool-winmerge-setup.sh
Created December 29, 2010 17:24
shell script that configures git to use WinMerge as the default tool to handle conflicts
#!/bin/sh
#
# This script will make WinMerge your default tool for diff and merge.
# It must run inside git bash (on Windows)
#
#
# If you experience path issues you should give a try to the gist
# created by markusobrist at https://gist.github.com/1010253
@jehiah
jehiah / bitly.rb
Created February 25, 2011 04:46 — forked from richardtifelt/bitly.rb
# Bit.ly API implementation - thanks to Richard Johansso http://gist.github.com/112191
require 'httparty'
class Api::Bitly
include HTTParty
base_uri 'api.bit.ly'
format :json
# Usage: Bitly.shorten("http://example.com")
def self.shorten(url)
@everton
everton / Bhaskara
Created April 6, 2011 13:45
Weird way to say Bhaskara in Ruby (or "((-b).± √ Δ(a, b, c))" / (2 * a) as a valid Ruby expression)
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
def √(n)
Math::sqrt(n)
end
class Numeric
def ±(n)
r = [self + n, self - n]
@kneipp
kneipp / gem install mysql2
Created May 23, 2011 19:36
Instalação gem mysql2 no OS X 10.6.7
Passos que segui para conseguir instalar a gem mysql2,
pois o comando de forma tradicional gem install mysql2 não estava funcionando.
1) locate mysql_config
Não listava nada, porém tenho mysql rodando aqui com PHP.
2) brew install mysql
3) locate mysql_config
/Applications/MAMP/Library/bin/mysql_config
@MarkusObrist
MarkusObrist / git-mergetool-winmerge-setup.sh
Created June 6, 2011 13:28 — forked from adilsoncarvalho/git-mergetool-winmerge-setup.sh
shell script that configures git to use WinMerge as the default tool to handle conflicts
#!/bin/sh
#
# This script will make WinMerge your default tool for diff and merge.
# It must run inside git bash (on Windows)
#
# If your WinMerge is in other place then this one, please edit
WINMERGE_SCRIPT="winmerge-merge.sh"
@sashich
sashich / redmine
Created June 15, 2011 05:17
redmine init.d shell script
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
#Output
<div class="section">
<h3>Sample Title</h3>
<div class="in">
<div class="field">
<label>Date</label><br/>
<input id="name" name="name" type="text">
</div>
</div>
</div>