Skip to content

Instantly share code, notes, and snippets.

View tarsisazevedo's full-sized avatar

Tarsis Azevedo tarsisazevedo

View GitHub Profile
@andrewsmedina
andrewsmedina / gist:1029865
Created June 16, 2011 18:21
align element vertically
.container {
line-height: 85px; /* container height */
}
.element {
display:inline;
display:inline-table;
display:inline-block;
vertical-align:middle;
}
@hernad
hernad / macosx_vim_ruby_python_support.md
Created June 3, 2011 17:31
macosx vim +ruby +python
@arthurfurlan
arthurfurlan / gist:947731
Created April 29, 2011 02:24
Example of the valvim's fabfile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# written by Arthur Furlan <[email protected]>
from __future__ import with_statement
from fabric.api import *
import socket
import time
@douglascamata
douglascamata / tail.py
Created April 27, 2011 04:59
Tail Call Optimization in Python
#!/usr/bin/env python2.4
# This program shows off a python decorator(
# which implements tail call optimization. It
# does this by throwing an exception if it is
# it's own grandparent, and catching such
# exceptions to recall the stack.
import sys
class TailRecurseException:
@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]
/*
---
Port from the YUI3 event-simulate functionality to vanilla javascript.
...
*/
(function(global, document){
var mix = function(obj1, obj2){
for (var key in obj2){
obj1[key] = obj2[key];
@rponte
rponte / git.shortlog.sh
Created March 25, 2011 12:46
Git Short Log
git shortlog -s | sort -rn | nl
@mlafeldt
mlafeldt / subprocess_check_output.py
Created February 22, 2011 23:47
[Python] subprocess.check_output() for Python < 2.7
#!/usr/bin/env python
import sys
from subprocess import *
#
# subprocess.check_output() is new in Python 2.7
#
def _check_output(*popenargs, **kwargs):
r"""Run command with arguments and return its output as a byte string.
@gabrielfalcao
gabrielfalcao / selenium_webdriver_browser.py
Created January 29, 2011 03:15
nice stuff, such as drag and drop for selenium2's webdriver
class SeleniumBrowser(object):
def __init__(self):
self.driver = WebDriver()
def _extract_error(self, exception):
regex = re.compile(ur'URL = (?P<url>\S+) Response_Code = (?P<status>\d+) Error_Message = (?P<message>.*)')
found = regex.search(unicode(exception))
if found:
return found.groupdict()
@ryanb
ryanb / github_tree_slider.js
Created December 6, 2010 17:23
This is how GitHub's new AJAX file browser works.
GitHub.TreeSlider = function () {
if (window.history && window.history.pushState) {
function a() {
if (e.sliding) {
e.sliding = false;
$(".frame-right").hide();
$(".frame-loading:visible").removeClass("frame-loading")
}
}
if (!($("#slider").length == 0 || !GitHub.shouldSlide)) if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {