This file contains hidden or 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
license: gpl-3.0 | |
height: 700 | |
scrolling: yes |
This file contains hidden or 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
license: gpl-3.0 |
This file contains hidden or 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
d3.hive={},d3.hive.link=function(){function t(t,s){var u,h=a(r,this,t,s),i=a(n,this,t,s);h.a>i.a&&(u=i,i=h,h=u),i.a-h.a>Math.PI&&(h.a+=2*Math.PI);var e=h.a+(i.a-h.a)/3,c=i.a-(i.a-h.a)/3;return h.r0-h.r1||i.r0-i.r1?"M"+Math.cos(h.a)*h.r0+","+Math.sin(h.a)*h.r0+"L"+Math.cos(h.a)*h.r1+","+Math.sin(h.a)*h.r1+"C"+Math.cos(e)*h.r1+","+Math.sin(e)*h.r1+" "+Math.cos(c)*i.r1+","+Math.sin(c)*i.r1+" "+Math.cos(i.a)*i.r1+","+Math.sin(i.a)*i.r1+"L"+Math.cos(i.a)*i.r0+","+Math.sin(i.a)*i.r0+"C"+Math.cos(c)*i.r0+","+Math.sin(c)*i.r0+" "+Math.cos(e)*h.r0+","+Math.sin(e)*h.r0+" "+Math.cos(h.a)*h.r0+","+Math.sin(h.a)*h.r0:"M"+Math.cos(h.a)*h.r0+","+Math.sin(h.a)*h.r0+"C"+Math.cos(e)*h.r1+","+Math.sin(e)*h.r1+" "+Math.cos(c)*i.r1+","+Math.sin(c)*i.r1+" "+Math.cos(i.a)*i.r1+","+Math.sin(i.a)*i.r1}function a(t,a,r,n){var e=t.call(a,r,n),c=+("function"==typeof s?s.call(a,e,n):s)+i,o=+("function"==typeof u?u.call(a,e,n):u),M=u===h?o:+("function"==typeof h?h.call(a,e,n):h);return{r0:o,r1:M,a:c}}var r=function(t){return t.source},n=f |
This file contains hidden or 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
#how to deal with this obnoxious issue. | |
git log | |
#look for the <commmit-id> of the offending commit | |
git rebase --onto <commit-id>^ <commit-id> HEAD |
This file contains hidden or 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 sum = 0; (1 to 10000) takeWhile { i => sum += i; sum <= 100 } } |
This file contains hidden or 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 fake_dt_formatter(month: String, day: String, time: String): Int = { | |
val YEAR_2016 = 1451606400 | |
val days: List[Int] = List(0,31,60,91,121,152,182,213,243,274,304,335) | |
val month_num = days("JanFebMarAprMayJunJulAugSepOctNovDec".indexOf(month) / 3) * 86400 | |
val day_num = (day.toInt-1) * 86400 | |
val time_vals = time.split(":") | |
val time_num = time_vals(0).toInt * 3600 + time_vals(1).toInt * 60 + time_vals(2).toInt | |
return YEAR_2016 + month_num + time_num + day_num | |
} |
This file contains hidden or 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 bean_counter(output_shots: Int) : Int = { | |
if (output_shots >= 0) { | |
return (output_shots/2)*20 + output_shots%2*16 | |
} else { | |
throw new IllegalArgumentException("Not a valid number of shots.") | |
} | |
} |
This file contains hidden or 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
# You are given a string s composed of letters and numbers, which was compressed with some algorithm. Every letter in s is followed by a number (possibly with leading zeros), which represents the number of times this letter occurs consecutively. For example, "aaaaaaaabbbbbbcc" would be given as "a8b6c2". | |
# Decompress s, sort its letters and return the kth (1-based) letter of the obtained string. | |
# Note: each letter occurs in s no more than 251 times. | |
# Example | |
# Expand_It("a2b3c2a1", 2) = "a" |
This file contains hidden or 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
while read d n | |
do | |
printf "%s\t%${n}s" "$d" = | tr ' ' '=' ; | |
echo " $n" ; | |
done < data.txt |
This file contains hidden or 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 memoize(f): | |
cache = {} | |
def decorated_function(*args): | |
if args in cache: | |
return cache[args] | |
else: | |
cache[args] = f(*args) | |
return cache[args] | |
return decorated_function |