Skip to content

Instantly share code, notes, and snippets.

View hugobarauna's full-sized avatar

Hugo Baraúna hugobarauna

View GitHub Profile
class Bookmark
def test
"hello world!"
end
end
# by bryan helmkamp with slight modification by chris wanstrath
# from http://www.brynary.com/2008/8/3/our-git-deployment-workflow
module GitCommands
extend self
def diff_staging
`git fetch`
puts `git diff origin/production origin/staging`
end
yahoo:
appid: your_app_id
secret: your_shared_secret
yahoo = Contacts::Yahoo.new
auth_url = yahoo.get_authentication_url
contacts = wl.contacts(path)
#-> [ ['Fitzgerald', '[email protected]', '[email protected]'],
# ['William Paginate', '[email protected]'], ...
# ]
module Spec
module Rails
module Example
# Controller Examples live in $RAILS_ROOT/spec/controllers/.
#
# Controller Examples use Spec::Rails::Example::ControllerExampleGroup, which supports running specs for
# Controllers in two modes, which represent the tension between the more granular
# testing common in TDD and the more high level testing built into
# rails. BDD sits somewhere in between: we want to a balance between
# specs that are close enough to the code to enable quick fault
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_deleted {
[[ $(git status 2> /dev/null | grep deleted:) != "" ]] && echo "-"
}
function parse_git_added {
[[ $(git status 2> /dev/null | grep "Untracked files:") != "" ]] && echo '+'
Depois de instalar o Ubuntu 9.04, os meus whitespaces do gedit (feito pelo plugin draw spaces) ficaram com cor branca e estavam confundindo meu código. Se você também usa o Gedit, usa o tema darkmate, usa o plugin draw spaces e também teve esse problema, basta fazer o seguinte:
1. Feche seu Gedit
2. Abra o shell e faça "cd /usr/share/gtksourceview-2.0/styles"
3. Dentro desse diretório, deve haver um arquivo chamado darkmate.xml, apague esse arquivo
4. Crie um novo arquivo darkmate.xml nesse diretorio e copie o texto abaixo xml abaixo para esse arquivo
5. Abra seu gedit novamente, tudo deve estar ok. Happy coding!
<?xml version="1.0" encoding="UTF-8"?>
# Used to graph results from autobench
#
# Usage: ruby autobench_grapher.rb result_from_autobench.tsv
#
# This will generate three svg & png graphs
require "rubygems"
require "scruffy"
require 'csv'
require 'yaml'
Program
program = { decl }
Declarações
decl = type var_list | type id "=" ( id | num | expr ) | func_decl | array | struct.
var_list = id { "," id } "\n".
array = type id "[" num "]" | type id "[" num "]" "=" "{" cte {, cte} "}".
struct = "struct" id "{" struct_var_list "}"
struct_var_list = type id "\n" { type id "\n" }.
type = "int" | "char" | "float" | "bool" | "void".