Skip to content

Instantly share code, notes, and snippets.

View squiter's full-sized avatar

Brunno dos Santos squiter

View GitHub Profile
@trey
trey / reset.sass
Created July 31, 2008 20:36
Eric Meyer's reset.css in Sass. Originally by @postpostmodern.
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain) */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
@domwom
domwom / gist:213542
Created October 19, 2009 17:45
php bitly api
function make_bitly_url($url, $login, $appkey, $format='xml', $history=1, $version='2.0.1')
{
//create the URL
$bitly = 'http://api.bit.ly/shorten';
$param = 'version='.$version.'&longUrl='.urlencode($url).'&login='
.$login.'&apiKey='.$appkey.'&format='.$format.'&history='.$history;
//get the url
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $bitly . "?" . $param);
@carlosbrando
carlosbrando / routes.rb
Created December 10, 2009 06:03
A nova DSL de rotas do Rails 3
ActionController::Routing::Routes.draw do |map|
# A prioridade é baseada na ordem da criação:
# criado primeiro -> maior prioridade.
# Exemplo de uma rota comum:
match 'products/:id', :to => 'catalog#view'
# Tenha em mente que você pode atribuir outros valores além de :controller e :action
# Exemplo de uma rota nomeada:
match 'products/:id/purchase', :to => 'catalog#purchase', :as => :purchase
@bitzesty
bitzesty / config.enviroment.rb
Created January 4, 2010 22:58
Getting up and running with MongoDB/MongoMapper
# config/enviroment.rb
config.gem 'mongo'
config.gem 'mongo_mapper'
# remove AR
config.frameworks -= [ :active_record, :active_resource ]
@bkeating
bkeating / howto-filemerge-git-osx.md
Created March 11, 2010 21:36
HOWTO: Using FileMerge (opendiff) with Git on OSX

HOWTO: Using FileMerge (opendiff) with Git on OSX

FileMerge (opendiff) can really come in handy when you need to visually compare merging conflicts. Other times it's just a nice visual way to review your days work.

The following method works by creating a simple bash script (git-diff-cmd.sh) that sets us up with the proper command line arguments for Git to pass off files to FileMerge.

#!/usr/bin/env node
var COMMIT_FILE = '/Users/felix/pp/commits.csv';
var exec = require('child_process').exec,
fs = require('fs');
exec('git log -1 HEAD --shortstat --pretty=format:"%ai%n%h%n%s"', function (err, stdout, stder) {
if (err) {
throw err;
}
@squiter
squiter / vhosts.php
Created May 26, 2011 19:46
Script para automatização da criação dos Virtual Hosts usados nos servidores de desenvolvimento da Equipe Abstraindo
<?php
/*
* Title: vhost.php
* Create_date: 2011.02.23
* Author: Abstraindo Team
* Version: 0.1
* Desc: Script para auto inserção de virtual host do Apache,
* adição de regra no arquivo host e envio de e-mail para os
* interessados.
* HowToUse: execute sudo php vhost.php $endereçoVhost $pathProject
@potomak
potomak / _flash.html.erb
Created January 12, 2012 14:35
Rails flash messages using Twitter bootstrap
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert-message <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
@kyanny
kyanny / gist:1668822
Created January 24, 2012 08:22
bashrc prompt git && rbenv
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
source ~/.rbenv/completions/rbenv.bash
# prompt with ruby version
# rbenv version | sed -e 's/ .*//'
__rbenv_ps1 ()
{
rbenv_ruby_version=`rbenv version | sed -e 's/ .*//'`
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 22, 2024 09:57
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'