Skip to content

Instantly share code, notes, and snippets.

View dankohn's full-sized avatar
☁️

Dan Kohn dankohn

☁️
View GitHub Profile
@dankohn
dankohn / k8s_contributors.sql
Last active February 26, 2017 02:45
K8s contributors
SELECT
actor.login as contributor,
COUNT(repo.name) AS commits,
FROM
[githubarchive:year.2016]
WHERE
type IN ("PushEvent") AND
repo.name = "kubernetes/kubernetes"
GROUP BY
contributor
@dankohn
dankohn / starbucks_us_locations.csv
Last active October 14, 2023 16:47
8902 locations of US Starbucks with addresses, latitude, and longitude
We can't make this file beautiful and searchable because it's too large.
-149.8935557,61.21759217,Starbucks - AK - Anchorage 00001,"601 West Street_601 West 5th Avenue_Anchorage, Alaska 99501_907-277-2477"
-149.9054948,61.19533942,Starbucks - AK - Anchorage 00002,"Carrs-Anchorage #1805_1650 W Northern Lights Blvd_Anchorage, Alaska 99503_907-339-0500"
-149.7522,61.2297,Starbucks - AK - Anchorage 00003,"Elmendorf AFB_Bldg 5800 Westover Avenue_Anchorage, Alaska 99506"
-149.8643361,61.19525062,Starbucks - AK - Anchorage 00004,"Fred Meyer - Anchorage #11_1000 E Northern Lights Blvd_Anchorage, Alaska 995084283_907-264-9600"
-149.8379726,61.13751355,Starbucks - AK - Anchorage 00005,"Fred Meyer - Anchorage #656_2300 Abbott Road_Anchorage, Alaska 99507_907-365-2000"
-149.9092788,61.13994658,Starbucks - AK - Anchorage 00006,"Fred Meyer - Anchorage (Dimond) #71_2000 W Dimond Blvd_Anchorage, Alaska 995151400_907-267-6700"
-149.7364877,61.19533265,Starbucks - AK - Anchorage 00007,"Safeway-Anchorage #1817_7731 E Northern Lights Blvd_Anchorage, Alaska 99504_907-331-1700"
-149.8211,61.2156
def access_own_records
return if @user.super_administrator?
# Anyone can read or update anything they create
[Appointment, Claim, Referral, Study].each do |model|
can([:edit, :index, :read, :update], model,
model.where(created_id: @user.id)) do |instance|
instance.created_id == @user.id
end
end
end
@dankohn
dankohn / circle.yml
Created July 16, 2014 16:47
Configuring CircleCI, Coveralls, and CodeClimate
## Customize test commands
test:
post:
- bundle exec rake coveralls:push
## Don't have CircleCI create coverage in an unexpected place, as coveralls wouldn't be able to find it.
general:
artifacts:
- "coverage"
@dankohn
dankohn / test_csv.js
Last active December 18, 2015 16:38
Parsing double-nested CSV fields
var csv = require('csv')
var cat = "Text"
var commaCat = "A, B, and C"
var cat2 = "More text"
csv()
.from.array([[cat,commaCat,cat2]])
.to.string( function(innerNest){
console.log(innerNest)
csv()
macbookair:~/Documents/dev$ git clone https://github.com/dankohn/express-test
Cloning into 'express-test'...
remote: Counting objects: 863, done.
remote: Compressing objects: 100% (724/724), done.
remote: Total 863 (delta 81), reused 855 (delta 73)
Receiving objects: 100% (863/863), 1.06 MiB | 996.00 KiB/s, done.
Resolving deltas: 100% (81/81), done.
macbookair:~/Documents/dev$ cd express-test/
macbookair:~/Documents/dev/express-test (master)$ heroku create
Creating secret-escarpment-4221... done, stack is cedar