Skip to content

Instantly share code, notes, and snippets.

View BBischof's full-sized avatar

Bryan Bischof BBischof

  • current: Hex | prev: Weights and Biases, Stitch Fix, Blue Bottle, QuasiCoherent Labs, IBM
  • Berkeley, California
  • X @bebischof
View GitHub Profile
@BBischof
BBischof / shitty_dt_formatter.scala
Last active May 12, 2016 00:21
This is the result of JODA not being serializable in scala, resorting to utter bullshit, assumes year is 2016.
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
}
@BBischof
BBischof / takeWhileSumLess.scala
Created April 12, 2016 22:07
I like this example of grabbing elements from a List until you reach your desired sum.
{ var sum = 0; (1 to 10000) takeWhile { i => sum += i; sum <= 100 } }
@BBischof
BBischof / delete_it.sh
Created May 12, 2016 00:20
deleting a specific git commit
#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
@BBischof
BBischof / d3.hive.min.js
Created May 24, 2016 03:06
International Travel Visa Topology -- Hive Plot Visualization
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
@BBischof
BBischof / .block
Created June 26, 2016 23:39
Orthographic Clipping
license: gpl-3.0
@BBischof
BBischof / .block
Last active July 16, 2016 05:08
Housing Violations Data - 2012
license: gpl-3.0
height: 700
scrolling: yes
@BBischof
BBischof / .block
Last active July 15, 2016 15:51
Visualizing Distributions
license: gpl-3.0
@BBischof
BBischof / .block
Last active July 24, 2016 20:09
Housing Violations Data - 2012
license: gpl-3.0
height: 700
scrolling: yes
@BBischof
BBischof / .block
Last active July 23, 2016 21:25
Calendar View
license: gpl-3.0
@BBischof
BBischof / .block
Last active July 24, 2016 19:11
Calendar View v4
license: gpl-3.0
height: 2910
border: no