This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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 } } }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query { | |
search(query: "is:public stars:>15", type: REPOSITORY, first:100) { | |
repositoryCount | |
edges { | |
node { | |
... on Repository { | |
nameWithOwner | |
stargazers { | |
totalCount | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
token.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MapboxGL, {LngLatLike, MercatorCoordinate} from 'mapbox-gl'; | |
import React, {useEffect, useState} from 'react'; | |
import {withMap} from 'react-mapbox-gl/lib-esm/context'; | |
import {FeatureCollection} from 'geojson'; | |
import * as THREE from 'three'; | |
import {GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader'; | |
export interface SpritePaint { | |
gltfPath: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handleDrag(eDown: Event) { | |
const targetEl = eDown.currentTarget; | |
targetEl.classList.add('dragging'); | |
// ~~~~~~~ Object is possibly 'null'. | |
// ~~~~~~~~~ Property 'classList' does not exist on type 'EventTarget'. | |
const dragStart = [ | |
eDown.clientX, eDown.clientY | |
// ~~~~~~~ 'clientX' does not exist on 'Event'. | |
// ~~~~~~~ 'clientY' does not exist on 'Event'. | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""Pretty-print GeoJSON in a slightly more compact way by putting coordinates on one line. | |
Compare: | |
[ | |
[ | |
37.23423, | |
79.23423 | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const inferKeys = <V extends {}>() => <K extends string>(x: Record<K,V>): Record<K,V> => x; | |
const INIT_VIEW = inferKeys<Partial<MapProps>>()({ | |
nyc: { | |
center: [-73.991284, 40.741263], | |
zoom: [14.5], | |
pitch: [45], | |
bearing: [-17.6], | |
}, | |
sf: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const inferPick = <V extends {}>() => <K extends keyof V>(x: Pick<V, K>): Pick<V, K> => x; | |
const INIT_VIEW = inferPick<MapProps>()({ | |
center: [-73.991284, 40.741263], | |
zoom: [14.5], | |
pitch: [45], | |
bearing: [-17.6], | |
style: "mapbox://styles/mapbox/streets-v9" | |
}); |