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
nato = { | |
"a": 'Alfa', | |
"b": 'Bravo', | |
"c": 'Charlie', | |
"d": 'Delta', | |
"e": 'Echo', | |
"f": 'Foxtrot', | |
"g": 'Golf', | |
"h": 'Hotel', | |
"i": 'India', |
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
first = function (a) { | |
return function (b) { | |
return function (c) { | |
if (c < 4) { | |
return c * (b + a); | |
} else { | |
return ((first(a))(b))(c-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
package main | |
import fmt "fmt" | |
type IntFunc func(int) int | |
type HiIntFunc func(int) IntFunc | |
func first(a int) HiIntFunc { | |
return func(b int) IntFunc { | |
return func(c int) int { |
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
@media print { | |
/*remove chrome links*/ | |
a[href]:after { | |
content: none !important; | |
} | |
.col-md-1, | |
.col-md-2, | |
.col-md-3, | |
.col-md-4, | |
.col-md-5, |
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
import sys | |
import random | |
class Ball(): | |
directions = [(-1, 0), (1, 0), (0, 1), (0, -1)] | |
def __init__(slf): | |
# None = wall, False == free space, or another Ball instance | |
slf.north = None |
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
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="bira" | |
plugins=(colored-man npm pep8 pip copyfile cp) | |
source $ZSH/oh-my-zsh.sh |
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
var try = function (callback, terminal_case_callback, times, interval) { | |
var number_of_times_tried = 0; | |
times = times || 1000; | |
interval = interval || 5; | |
var _timeout_id = setInterval(function () { | |
callback(); | |
if (terminal_case_callback() || number_of_times_tried > times) { | |
clearInterval(_timeout_id); | |
} | |
}, interval) |
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
# udacity ps 5.1 | |
# | |
class BinaryHeap(object): | |
"""BinaryHeap for maintaining ordered | |
list of nodes with smallest score at the | |
top of the heap. |
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 update_not_x(k, array, num): | |
if k > len(array) - 1 or array[k] == num: | |
return 0 | |
else: | |
return 1 | |
def update_count_x(i, array, num): | |
if i == 0 or array[i - 1] != num: | |
return 0 |
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
/** | |
* Synchronizes local system time with server time | |
* using clock synchronization algorithm, similar to | |
* NTP. | |
* | |
* Pings server every half second for server time. | |
* Calculates offset as difference between server time | |
* and browser time before and after socket request. | |
* | |
* Keeps track of last 5 offsets and calculates current |
OlderNewer