Skip to content

Instantly share code, notes, and snippets.

View danvk's full-sized avatar

Dan Vanderkam danvk

View GitHub Profile
@danvk
danvk / h-over-15.csv
Created February 9, 2020 17:39
h-index of GitHub organizations/users (down to 15)
h-index organization
347 google
314 microsoft
216 apache
206 fossasia
203 sindresorhus
142 googlearchive
137 mozilla
133 alibaba
132 spatie
@danvk
danvk / low-star-range.csv
Created February 9, 2020 17:33
Results for low star range queries
Query Number of results
stars:15..20 created:2017-05-02..2017-05-11 742
stars:15..20 created:2017-05-12..2017-05-20 630
stars:15..20 created:2017-05-30..2017-06-07 631
stars:15..20 created:2017-06-08..2017-06-17 771
stars:15..20 created:2017-06-18..2017-06-26 638
stars:15..20 created:2017-06-27..2017-07-05 674
stars:15..20 created:2017-07-06..2017-07-14 643
@danvk
danvk / collect_repos.py
Created February 9, 2020 17:25
Collect all the repos with >=15 stars using a recursive partitioning scheme
def split_interval(a, b):
d = int((b - a) / 2)
return [(a, a + d), (a + d + 1, b)]
def split_by_days(stars, day_start, day_end):
start_fmt = day_start.strftime('%Y-%m-%d')
end_fmt = day_end.strftime('%Y-%m-%d')
q = query_for_star_dates(stars, start_fmt, end_fmt)
c = get_count(q)
@danvk
danvk / star-ranges-dates.csv
Created February 9, 2020 17:12
Star ranges with dates
Query Number of Results
stars:400..420 2524
stars:400..420 created:<2015 947
stars:400..420 created:2015..2016 777
stars:400..420 created:>2016 799
@danvk
danvk / star-ranges.csv
Last active February 9, 2020 17:01
Repos with star ranges
Query Number of Results
stars:>15000 724
stars:9000..15000 960
stars:7000..9000 782
stars:5500..7000 917
stars:4600..5500 900
stars:4000..4600 801
stars:3500..4000 939
... ...
@danvk
danvk / results.json
Created February 9, 2020 15:58
Top GitHub repos by stars
{
"search": {
"repositoryCount": 704279,
"edges": [
{ "node": { "nameWithOwner": "freeCodeCamp/freeCodeCamp", "stargazers": { "totalCount": 308427 } } },
{ "node": { "nameWithOwner": "996icu/996.ICU", "stargazers": { "totalCount": 249062 } } },
{ "node": { "nameWithOwner": "vuejs/vue", "stargazers": { "totalCount": 156364 } } },
{ "node": { "nameWithOwner": "facebook/react", "stargazers": { "totalCount": 143121 } } },
{ "node": { "nameWithOwner": "tensorflow/tensorflow", "stargazers": { "totalCount": 140562 } } },
{ "node": { "nameWithOwner": "twbs/bootstrap", "stargazers": { "totalCount": 138369 } } },
@danvk
danvk / repos-with-stars.graphql
Created February 9, 2020 15:56
Getting a list of repos with starcount from GitHub
query {
search(query: "is:public stars:>15", type: REPOSITORY, first:100) {
repositoryCount
edges {
node {
... on Repository {
nameWithOwner
stargazers {
totalCount
}
def make_angle_map(station_loc, asteroids):
d = defaultdict(list)
x, y = station_loc
for a in asteroids:
ax, ay = a
angle = math.atan2(y - ay, ax - x)
d2 = (x - ax) ** 2 + (y - ay) ** 2
d[angle].append((d2, a))
for angle, pairs in d.items():
d[angle] = [*sorted(pairs)]
@danvk
danvk / expression.test.ts
Created October 28, 2019 15:33
TypeScript API for Mapbox GL Style Expressions
import {Expression} from './expression';
describe('Expression', () => {
it('should work with constants', () => {
expect(Expression.parse(0).evaluate(null!)).toEqual(0);
expect(Expression.parse(10).evaluate(null!)).toEqual(10);
});
it('should add', () => {
expect(Expression.parse(['+', 1, 2]).evaluate(null!)).toEqual(3);
});
@danvk
danvk / .gitignore
Last active April 14, 2020 14:32
Repro of texture issue for MapboxGL and THREE.js
token.js