Skip to content

Instantly share code, notes, and snippets.

View bltavares's full-sized avatar
💭
I may be slow to respond.

Bruno Tavares bltavares

💭
I may be slow to respond.
View GitHub Profile
@bltavares
bltavares / git-config.sh
Last active October 4, 2015 22:07
Ubuntu Post-install
git config --global user.name "Bruno Tavares"
git config --global alias.s "status -sb"
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.l log
git config --global alias.graph "log --graph --decorate --oneline --branches"
git config --global alias.df "diff --cached --color-words"
git config --global alias.dff "diff --color-words"
git config --global color.ui always
git config --global core.excludesfile ~/.gitignore_global
@bltavares
bltavares / Main.hs
Created June 6, 2012 14:28
WCC 12.23
import Data.List
import Data.Tree
data Operator = Plus | Minus | Times | By | None deriving (Eq)
instance Show Operator where
show Plus = "+"
show Minus = "-"
show Times = "*"
show By = "/"
show None = "Initial"
@bltavares
bltavares / Main.hs
Created June 13, 2012 23:17
wcc 12.24
import Data.List
longestSubset xs = last $ sortBy summing $ subsets xs
where subsets = concatMap inits . tails
summing x y = sum x `compare` sum y
main = do
let arry = [(-2), 1, (-3), 4, (-1), 2, 1, (-5), 4]
print $ longestSubset arry
@bltavares
bltavares / Main.hs
Created June 21, 2012 23:27
WCC 2012.25 + 2012.26
import Data.Bits
mySum :: Int -> Int -> Int
mySum a b
|carry == 0 = result
|otherwise = mySum result $ shift carry 1
where carry = (.&.) a b
result = xor a b
mySubtraction :: Int -> Int -> Int
@bltavares
bltavares / README.md
Created September 2, 2012 19:57
Firefox hackday

Mozilla hackday

This is the result of the Mozilla's hackday after BrazilJS 2012.

The idea is to create a text-to-speech app to run on the Firefox OS.

Due to some restrictions (like audio media and cross-domain requests) we need to setup a small proxy. It is written in ruby, using sinatra and it requires ffmpeg to be installed with vorbis support.

Installation

@bltavares
bltavares / gist:3629894
Created September 5, 2012 03:31
Regex tuesday
http://callumacrae.github.com/regex-tuesday/
Challenge 1
/(\b(?:\w|')+) (\1\b)/ig -> $1 <strong>$2</strong>
return (function(){
function extractAssignments(role) {
return $("#" + role + " tbody tr").map(function() {
var $this = $(this);
var name = $this.find(".assignee-names").text().trim().replace(/ +/, " ");
var id;
if(name !== "None") {
id = $this.find(".assignee-names a").attr("href").match(/consultants\/(\d+)/)[1];
}
@bltavares
bltavares / robot.js
Created December 6, 2012 18:50
Let it rain
var robotFound = false;
var direction = 1;
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
if(!robotFound) {
robot.rotateCannon(1 * direction);
@bltavares
bltavares / robot.js
Created December 6, 2012 21:59
Pink warrior
var robotFound = {"one" : false
,"two": false};
var splited = false;
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
var direction = 1;