Skip to content

Instantly share code, notes, and snippets.

@grifo
grifo / fizzbuzz-fibo.js
Created Aug 2, 2012
Desafios do Code n' Bier de 01 agosto de 2012
View fizzbuzz-fibo.js
function fizzbuzz(a, b) {
for (var i = a; i <= b; i++) {
if (i % 3 == 0 && i % 5 == 0) {
console.log("Fizzbuzz");
} else if (i % 5 == 0) {
console.log("Buzz");
} else if (i % 3 == 0) {
console.log("Fizz");
} else {
console.log(i);
@grifo
grifo / gist:2828449
Created May 29, 2012
Solução de João Paulo Murowaniecki Sant'Anna e Guilherme Medeiros
View gist:2828449
/* ____ _ _
/ ___|___ _ __ ___ _ __ __ _ _ __ | |__ (_) __ _
| | / _ \| '_ ` _ \| '_ \ / _` | '_ \| '_ \| |/ _` |
| |__| (_) | | | | | | |_) | (_| | | | | | | | | (_| |
\____\___/|_| |_| |_| .__/ \__,_|_| |_|_| |_|_|\__,_|
|_|
____ _ _ _ _ ____ _ _
/ ___(_) |__ ___ _ __ _ __ ___| |_(_) ___ __ _ / ___|(_)_ __(_)_ _ ___
| | | | '_ \ / _ \ '__| '_ \ / _ \ __| |/ __/ _` | \___ \| | '__| | | | / __|
| |___| | |_) | __/ | | | | | __/ |_| | (_| (_| | ___) | | | | | |_| \__ \
View jquery.sort.js
$.fn.tableSort = function (col, order){
function toNumber(number) {
return parseFloat(number.replace(/\./g,"").replace(/,/g,"."))
}
return this.each(function(){
var rows = [].slice.call(this.rows, 0).sort(function(a,b){
if (order === 'desc') b = [a,a=b][0]; // troca-troca
var textA = $(a.cells[col]).text()
, textB = $(b.cells[col]).text()
You can’t perform that action at this time.