Skip to content

Instantly share code, notes, and snippets.

View danvk's full-sized avatar

Dan Vanderkam danvk

View GitHub Profile
@danvk
danvk / index.d.ts
Created February 20, 2021 20:38
Reviving the old @types/dygraphs tests
// Type definitions for dygraphs 2.1
// Project: http://dygraphs.com
// Definitions by: Dan Vanderkam <https://github.com/danvk>
// Martin Badin <https://github.com/martin-badin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="google.visualization" />
declare namespace dygraphs {
type DataArray = Array<Array<number | Date | null>>;
@danvk
danvk / index.md
Last active November 15, 2020 19:16
JS Poland Talk

What is TypeScript?

TypeScript does two things:

  1. Compiles TypeScript to JavaScript ("transpiling").
  2. Performs static type analysis on your code.
async function f() { const funFact = await fetch('http://numbersapi.com/42');
@danvk
danvk / index.html
Created February 25, 2020 23:27
Flailing around with raycasting
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Raycasting with Mapbox</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.4.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.4.0/mapbox-gl.css' rel='stylesheet' />
<style>
@danvk
danvk / h-index-top.csv
Created February 10, 2020 03:24
Top h-index orgs/users on GitHub
h-index organization
347 google
314 microsoft
216 apache
206 fossasia
203 sindresorhus
142 googlearchive
137 mozilla
133 alibaba
132 spatie
@danvk
danvk / h-index-top-50.csv
Created February 10, 2020 03:12
Comparison of the top 50 users/orgs by h-index and total stars
h-index org/user type Rank (h-index) Rank (stars)
347 google Organization 1 1
314 microsoft Organization 2 2
216 apache Organization 3 4
206 fossasia Organization 4 13
203 sindresorhus User 5 5
142 googlearchive Organization 6 ???
137 mozilla Organization 7 19
133 alibaba Organization 8 6
132 spatie Organization 9 65
@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
... ...