Skip to content

Instantly share code, notes, and snippets.

View ctbarna's full-sized avatar

Chris Barna ctbarna

View GitHub Profile
@ctbarna
ctbarna / wait.csv
Last active March 17, 2022 16:24
Wait times at NYC H&H COVID testing sites. Updated about every 10 minutes between 8am and 8pm EST. Code at https://github.com/ctbarna/covid-wait-times
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
fullname,wait_time,last_reported,address,lat,lng,borough,location
Former Saint John Villa HS,Not Reported Yet,,"57 Cleveland Pl, Staten Island, NY 10305",40.6012163,-74.0687077,Staten Island,57 Cleveland Place
Bay Ridge 5th Avenue,Not Reported Yet,,"8511 & 8515 5th Ave., Brooklyn, NY 11209",40.6215669,-74.0259145,Brooklyn,Bay Ridge 5th Avenue
NYC Health + Hospitals / Bellevue,No Wait Time*,11:55 AM,"462 1st Ave., New York, NY 10016",40.7397258,-73.976201,Manhattan,Bellevue Hospital Cent...
"NYC Health + Hospitals/Gotham Health, Belvis",Not Reported Yet,,"545 E 142nd St., Bronx, NY 10454",40.8104385,-73.9159236,Bronx,Belvis Diagnostic & Tr...
NYC Health + Hospitals Bensonhurst 14th Ave,No Wait Time*,11:12 AM,"6315 14th Ave., Brooklyn, NY 11219",40.625407,-73.9979369,Brooklyn,Bensonhurst 14th Avenue
NYC Health + Hospitals/Coney Island,Not Reported Yet,,"2601 Ocean Pkwy, Brooklyn, NY 11235",40.5850562,-73.96546049999999,Brooklyn,Coney Island Hospital ...
CLOSED?,Not Reported Yet,,"1601 Ave. S, Brooklyn, NY 11229
@ctbarna
ctbarna / API.md
Created September 14, 2016 12:28

Department of Education

  • Documentation is clear, if a little poorly formatted.
    • Not the biggest fan of the monospace type as body copy.
    • I like the queries tab but it's not immediately obvious that it's something that I can interact with.
  • Document the data that gets returned!
  • Correct types.
    • Numbers should be unquoted
  • Are all the "note on count/percentage"s the same for every endpoint? If
@ctbarna
ctbarna / 0_reuse_code.js
Created January 14, 2016 19:33
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
class ContentTypeForeignKey(models.ForeignKey):
def __init__(self, **kwargs):
if "choices" in kwargs:
kwargs["choices"] = self._process_choices(kwargs["choices"])
# It is possible for `to` to be passed in with **kwargs. Since
# ContentType is hardcoded in for the `to` arg when calling super(),
# this can lead to problems.
if "to" in kwargs:
del kwargs["to"]
@ctbarna
ctbarna / m.js
Created October 15, 2012 22:29
Round orders of magnitude in JS.
function m(n, d) {
P = Math.pow;
R = Math.round
d = P(10, d);
i = 7;
while(i) {
(s = P(10, i-- * 3)) <= n && (n = R(n * d / s) / d + "KMGTPE"[i])
}
@ctbarna
ctbarna / createContext.js
Created October 9, 2012 19:31
Closure to generate a contextual jQuery selector.
var $createContext = function (context) { return function(selector) { return $(selector, context) }; };
@ctbarna
ctbarna / do_this.py
Created August 7, 2012 21:50
Abstracting comparisons in Python
import operator
def do_this (operation, a, b):
return getattr(operator, operation)(a, b)
do_this('eq', 1, 1) # returns True
do_this('gt', 1, 0) # returns True
do_this('le', 1, 0) # returns False
@ctbarna
ctbarna / interpolator.coffee
Created August 2, 2012 02:05
Coffeescript Color Interpolator
root = exports ? window
Number::toPaddedString = (radix, digits=2) ->
str = this.toString(radix)
while str.length < digits
str = "0" + str
str
Number::toPaddedString = (radix, digits=2) ->
str = this.toString(radix)
while str.length < digits
str = "0" + str
str
@ctbarna
ctbarna / hw4prob1.r
Created May 12, 2012 20:21
2d Ising Model
# hw4prob1.r
# 2d ising model
hamiltonian <- function (E, J, sig, N) {
nearest_neighbor_sum = sum(sig[1:N-1,]*sig[2:N,], sig[,1:N-1]*sig[,2:N])
return(-E * nearest_neighbor_sum - J * sum(sig))
}
ising <- function (E, J, N, beta, iterations) {
number = N*N