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
words = [w.strip() for w in open('/usr/share/dict/words').readlines()] | |
print([w for w in words if len(w) == 8 and w[0] == w[6] | |
and w[1] == w[3] and w[1] == w[5] and w[2] == w[7]]) |
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
{ | |
"SOVIETSECRET": { | |
"exercises": [ | |
"hangboard", | |
"offset pullups", | |
"push ups", | |
"100 ab wheel reps" | |
] | |
}, | |
"MOSTLYHGH": { |
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
//obj1 and obj2 are mongoose models | |
//Doesn't work | |
aync.parallel([obj1.save, obj2.save], function(err, results){ | |
//do stuff after both objects save | |
}); | |
//Works | |
aync.parallel([obj1.save.bind(obj1), obj2.save.bind(obj2)], function(err, results){ |
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 FirstReverse(str){ | |
var reverseBucket = ""; | |
for(var i = 0; i < str.length; i++){ | |
var swapNumber = str.length - 1 - i; | |
var showString = str[swapNumber]; | |
reverseBucket = reverseBucket + showString ; | |
console.log("\ni: " + i); | |
console.log("swapNumber: " + swapNumber); |
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
a b c d e f g h | |
0 1 2 3 4 5 6 7 | |
stuff.length = 8 | |
var i = 0; var tmp = stuff[0]; //a stuff[0] = stuff[7] //7 - 0 = 7 | |
var i = 1; var tmp = stuff[1]; //b stuff[1] = stuff[6] //7 - 1 = 6 | |
var i = 2; var tmp = stuff[2]; //c stuff[2] = stuff[5] //7 - 2 = 5 | |
var i = 3; var tmp = stuff[3]; //d stuff[3] = stuff[4] //7 - 3 = 4 |
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
extension Optional{ | |
func omap<K:Any>(optionalBlock:(T)->(K?))->K?{ | |
if self{ | |
return optionalBlock(self!) | |
} | |
return nil | |
} | |
} |
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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] ($(parse_git_branch))\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
fi |
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
javascript:(function(){ pgn = ""; currentBoard = $(".boardContainer:not(.chess_com_hidden, .visibilityHidden)"); pgn += '[White "' + currentBoard.find("[id^=white_player_name_]").text() + '"]\n[Black "' + currentBoard.find("[id^=black_player_name_]").text() + '"]\n[Result "*"]\n\n'; $(".dijitVisible").find('.gotomove').each(function(index, element){if(index % 2 == 0){pgn += ((index + 2) / 2) + ". "};pgn += $(this).text() + " "});pgn += " *"; alert(pgn); })(); |