Skip to content

Instantly share code, notes, and snippets.

View dankohn's full-sized avatar
☁️

Dan Kohn dankohn

☁️
View GitHub Profile
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
@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
@dankohn
dankohn / commits.sql
Created February 26, 2017 03:07
GitHub Commits
SELECT
repo.name AS repository,
COUNT(repo.name) AS commits,
EXACT_COUNT_DISTINCT(actor.login) AS contributors
FROM
[githubarchive:year.2016]
WHERE
type IN ("PushEvent")
GROUP BY
repository
@dankohn
dankohn / FizzBuzz
Last active February 7, 2018 19:56
puts 1.upto(100).map { |n| "#{'Fizz' if n%3==0}#{'Buzz' if n%5==0}".presence || n }
OOOO
OOOOOOOOOO
ZZOOOOOOOOOOO
ZZZZZOOOOOOOOOOO
ZZZZZZZZZOOOOOOOOOO
ZZZZZZZZZZZOOOOOOOOOOO $$$$$$
ZZZZZZZZZZZZZZZOOOOOOOOOOO $$$$$$$$$
ZZZZZZZZZZZZZZZZZZOOOOOOOOOOO$$$$$$$$$$$$$
ZZZZZZZZZZZZZZZZZZ ~OOOOOOMMM$$$$$$$$$$$$
@dankohn
dankohn / danserve.rb
Last active December 19, 2017 17:40
Simple key-value server
# frozen_string_literal: true
class Server
def get(query)
respond "db: #{@db}"
return unless (value = query['key'])
if (lookup = @db[value])
respond "successful lookup: #{value} => #{lookup}"
else respond "failed lookup: no entry for #{value}"
end
SELECT
repo.name AS repository,
COUNT(*) AS pull_requests,
EXACT_COUNT_DISTINCT(actor.login) AS contributors
FROM
[githubarchive:year.2016]
WHERE
type IN ( 'PullRequestEvent')
AND JSON_EXTRACT(payload, '$.action') IN ('"opened"')
GROUP BY
@dankohn
dankohn / commits_and_authors.sql
Created February 26, 2017 08:19
Commits and authors
SELECT
repo.name AS repository,
COUNT(repo.name) AS commits,
EXACT_COUNT_DISTINCT(actor.login) AS committers,
EXACT_COUNT_DISTINCT(JSON_EXTRACT(payload, '$.commits[0].author.email')) AS authors
FROM
[githubarchive:year.2016]
WHERE
type IN ("PushEvent")
GROUP BY
@dankohn
dankohn / project_commits.sql
Created February 26, 2017 06:32
Project commits
SELECT
repo_name AS repository,
EXACT_COUNT_DISTINCT(author.name) AS authors,
EXACT_COUNT_DISTINCT(committer.name) AS committers,
COUNT(*) AS commits
FROM
[bigquery-public-data:github_repos.commits]
WHERE
repo_name IN ( "torvalds/linux",
"facebook/react-native",
@dankohn
dankohn / by_commit.sql
Created February 26, 2017 06:06
By commit
SELECT
repo_name AS repository,
EXACT_COUNT_DISTINCT(author.name) AS authors,
EXACT_COUNT_DISTINCT(committer.name) AS committers,
COUNT(*) AS commits
FROM
[bigquery-public-data:github_repos.commits]
WHERE
committer.date >= TIMESTAMP("2016-01-01 00:00:00")
AND committer.date < TIMESTAMP("2017-01-01 00:00:00")