This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Curto Café Facebook Page</title> | |
<script src="preprocess.js" charset="utf-8"></script> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script src="http://syntagmatic.github.io/parallel-coordinates/d3.parcoords.js" charset="utf-8"></script> | |
<link href="http://syntagmatic.github.io/parallel-coordinates/d3.parcoords.css" rel="stylesheet" /> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function preprocess(post){ | |
var flatPost = post.insights.data.reduce(function(post, insight){ | |
post[insight.name] = insight.values[0].value; | |
return post; | |
}, {}); | |
flatPost.likes = post.likes.summary.total_count; | |
flatPost.comments = post.comments.summary.total_count; | |
flatPost.shares = (post.shares || {'count': 0}).count; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(master) $ # starting a new task | |
(master) $ git pull --ff-only upstream master | |
(master) $ git checkout -b feature/new-task | |
(feature/new-task) $ # some coding | |
(feature/new-task) $ git add -p | |
(feature/new-task) $ git commit -m "The answer of all questions of the universe" | |
(feature/new-task) $ git push origin feature/new-task | |
(feature/new-task) $ # Do a pull request from feature/new-task to master and wait for coworker acceptance | |
(feature/new-task) $ git checkout master | |
(master) $ git pull --ff-only upstream master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function create_fibonacci(){ | |
var n1 = -1, | |
n2 = 1, | |
n = 0; | |
return function(){ | |
n = n1 + n2; | |
n1 = n2; | |
n2 = n; | |
return n; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function create_iterator(list){ | |
var index = 0; | |
return function(){ | |
if(index == list.length){ | |
return false; | |
}else{ | |
return list[index++]; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function apply_template($template_path, $vars = array()){ | |
ob_start(); | |
extract($vars); | |
include($template_path); | |
$ob_contents = ob_get_contents(); | |
ob_end_clean(); | |
return $ob_contents; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function test($expected, $obtained){ | |
if($expected != $obtained){ | |
return "Falha, $expected é diferente de $obtained"; | |
}else{ | |
return "Ok"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this one comes from the book | |
def divide(x, y) | |
return {:q => 0, :r => 0} if x==0 | |
result = divide(x/2, y) | |
result[:q] *= 2 | |
result[:r] *= 2 | |
result[:r] += 1 if x.odd? | |
if result[:r] >= y | |
result[:r] -= y | |
result[:q] += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def keys_from_dicts(dicts): | |
all_keys = sum(map(dict.keys, dicts), []) | |
return list(set(all_keys)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
p(){ | |
cd $(find ~/Projects/ -name $1) | |
} |
OlderNewer