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
from math import ceil, floor, log10 | |
def pascal(rows, p_row): | |
print(" "*rows+ " ".join([" "*(3-floor(log10(x))) + str(x) for x in p_row])) | |
if rows: | |
p_row.append(1) | |
for i in reversed(range(ceil(len(p_row)/2)-1)): | |
p_row[i+1] += p_row[i] | |
p_row[-(i+2)] = p_row[i+1] | |
pascal(rows-1, p_row) |
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
Array.prototype.flatten = function() { | |
return this.reduce(function(prev, cur) { | |
var more = [].concat(cur).some(Array.isArray); | |
return prev.concat(more ? cur.flatten() : cur); | |
},[]); | |
}; | |
String.prototype.format = function () { | |
var content = this; | |
// regular for loop would probably be more efficient than the forEach |
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
{ | |
"font_face": "Consolas", | |
"font_size": 8, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"tab_size": 4, | |
"translate_tabs_to_spaces": true | |
} |
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
$("h1, h2, h3, h4, span, p").text(function(index, text){ return text.replace(/o/ig, "🎃").replace(/a/ig, "💀"); }); |