Skip to content

Instantly share code, notes, and snippets.

View egermano's full-sized avatar
🏠
Working from home

Bruno Germano egermano

🏠
Working from home
View GitHub Profile
@egermano
egermano / post-commit
Last active December 18, 2015 02:58
Post commit com frasees do Marvin do Guia
#!/usr/bin/env python
# coding=utf-8
# -*- coding: utf-8 -*-
import os
import random
marvin = [
"DON'T PANIC!",
"Ah, a vida. Pode-se odiá-la ou ignorá-la, mas é impossível gostar dela.",
vendor(prop, args)
-webkit-{prop} args
-moz-{prop} args
-ms-{prop} args
-o-{prop} args
{prop} args
border-radius()
vendor('border-radius', arguments)
@egermano
egermano / post-update
Created January 22, 2013 16:12
git deploy stage or in diferente branch than master
#!/bin/sh
export GIT_DIR=$(pwd)
cd /var/www/path/to/server/
git checkout -f master
git checkout -f developer
@egermano
egermano / post-receive
Created January 22, 2013 16:10
git deploy with stylus
#!/bin/sh
#path to project on server
GIT_WORK_TREE=/var/www/path/to/project/ git checkout -f
# other instructions on deploy
cd /var/www/path/to/project
# Compile Stylus
stylus --include /usr/local/lib/node_modules/nib/lib app/static/style/main.styl
stylus app/static/style/tab.styl
@egermano
egermano / post-receive
Created January 22, 2013 16:09
simple git deploy
#!/bin/sh
#path to project on server
GIT_WORK_TREE=/var/www/path/to/project/ git checkout -f
@egermano
egermano / post-commit
Created November 22, 2012 18:08
gitshots
#!/usr/bin/env ruby
file="~/Dropbox/Photos/gitshots/#{Time.now.to_i}.jpg"
puts "Taking capture into #{file}!"
system "imagesnap -q -w 3 #{file}"
exit 0
@egermano
egermano / gist:3745791
Created September 18, 2012 20:47
Get Day Delta
function getDayDelta(incomingYear,incomingMonth,incomingDay){
var incomingDate = new Date(incomingYear,incomingMonth-1,incomingDay),
today = new Date(), delta;
// EDIT: Set time portion of date to 0:00:00.000
// to match time portion of 'incomingDate'
today.setHours(0);
today.setMinutes(0);
today.setSeconds(0);
today.setMilliseconds(0);
@egermano
egermano / insertion.sort.js
Created September 11, 2012 17:48
Insertion Sort
function insertionSort(values) {
var length = values.length;
for(var i = 1; i < length; ++i) {
var temp = values[i];
var j = i - 1;
for(; j >= 0 && values[j] > temp; --j) {
values[j+1] = values[j];
}
values[j+1] = temp;
}
@egermano
egermano / bubble.sort.js
Created September 11, 2012 15:17
Bubble Sort
function bubbleSort(values) {
var length = values.length - 1;
do {
var swapped = false;
for(var i = 0; i < length; ++i) {
if (values[i] > values[i+1]) {
var temp = values[i];
values[i] = values[i+1];
values[i+1] = temp;
swapped = true;
@egermano
egermano / binary.search.js
Created September 11, 2012 15:14
Binary Search
function binSearch(values, target) {
return binarySearch(values, target, 0, values.length - 1);
};
function binarySearch(values, target, start, end) {
if (start > end) { return -1; } //does not exist
var middle = Math.floor((start + end) / 2);
var value = values[middle];