This file contains 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 { Plugin } from 'postgraphile'; | |
import type { PgClass, PgAttribute } from 'graphile-build-pg'; | |
// | |
// This plugin disables all filtering and sorting by default, and requires you | |
// to opt in to each table and column you want to filter or sort. | |
// | |
// PostGraphile's default behavior is: | |
// - Every GraphQL type and connection has `condition` and `orderBy` args. |
This file contains 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
/* | |
Note: if you only want to format a date as a string and not do any date | |
manipulation, you can use provided formatting functions to specify a time zone: | |
const date = new Date(dateString); | |
const formattedDate = date.toLocaleDateString('en-US', { timeZone: 'UTC' }); | |
All JavaScript Date objects are in the browser's local time zone. There's no way | |
around that. This means that if you receive a date string from the backend and | |
create a Date object with `new Date(unixTimestampOrISOString)` that Date object |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Parcel Sandbox</title> | |
<meta charset="UTF-8" /> | |
</head> | |
<body> | |
<button onclick="document.write('<input autofocus />')">Add a new input with autofocus</button> |
This file contains 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
type Word = string; | |
// A game is a series of guesses and a status (note that a Game might still be | |
// in progress, and the current game status is the same as the status of the | |
// last guess). | |
type Game = { | |
readonly guesses: Guess[]; | |
readonly status: Status; | |
}; |
This file contains 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
// From: https://youtu.be/-w-P4u0x8ig?t=3075 | |
function countMeetings(hallway) { | |
// Let's go over the hallway from left to right and keep track of how many | |
// people are moving right behind us at that point. Each time we encounter | |
// someone moving left, we know they will meet everyone who is moving right | |
// behind us at that point, so we add that number to the meetings count. | |
let peopleMovingRightBehindUs = 0; | |
let meetings = 0; | |
for (const char of hallway) { |
This file contains 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
asdfadsf |
This file contains 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
Flexport | https://www.flexport.com | San Francisco | |
---|---|---|---|
SpaceX | http://www.spacex.com | Hawthorne, California | |
Coinbase | https://www.coinbase.com/ | San Francisco | |
InVision | https://www.invisionapp.com/ | New York City, New York | |
Carta (company) | http://carta.com | San Francisco | |
Ripple (cryptocurrency) | https://ripple.com/ | San Francisco | |
Calm (company) | https://www.calm.com/ | San Francisco | |
WeWork | https://www.wework.com/ | Manhattan, New York City |
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 12 columns, instead of 1 in line 6.
This file contains 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
Series_reference,Period,Data_value,STATUS,UNITS,Subject,Group,Series_title_1,Series_title_2,Series_title_3,Series_title_4,Series_title_5 | |
CEPQ.S2371,1996.12,899,FINAL,Index,Capital Goods Price Index - CEP,"Price Index by Item - Plant, Machinery and Equipment (Base: Sept 1999 = 1000)",Glass and glass products,,,, | |
CEPQ.S2371,1997.03,884,FINAL,Index,Capital Goods Price Index - CEP,"Price Index by Item - Plant, Machinery and Equipment (Base: Sept 1999 = 1000)",Glass and glass products,,,, | |
CEPQ.S2371,1997.06,925,FINAL,Index,Capital Goods Price Index - CEP,"Price Index by Item - Plant, Machinery and Equipment (Base: Sept 1999 = 1000)",Glass and glass products,,,, | |
CEPQ.S2371,1997.09,932,FINAL,Index,Capital Goods Price Index - CEP,"Price Index by Item - Plant, Machinery and Equipment (Base: Sept 1999 = 1000)",Glass and glass products,,,, | |
CEPQ.S2371,1997.12,929,FINAL,Index,Capital Goods Price Index - CEP,"Price Index by Item - Plant, Machinery and Equipment (Base: Sept 1999 = 1000)",Glass and glass products,,,, | |
CEPQ.S2 |
This file contains 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 generateStationarySquares(maxRad, squareCount) { | |
const squares = []; | |
for (let i = 0; i < squareCount; i++) { | |
// Divide maxRad by sqrt(2) i times. | |
const rad = maxRad / Math.pow(Math.sqrt(2), i); | |
// We want the outermost stationary square to be rotated 90 degrees, like a | |
// diamond. | |
const ang = i % 2 === 0 ? Math.PI / 4 : 0; | |
squares.push([rad, ang]); | |
} |
This file contains 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 preferred_numbers(x, precision = 2): | |
""" | |
>>> preferred_numbers(2) | |
[1.0, 3.16] | |
>>> preferred_numbers(3) | |
[1.0, 2.15, 4.64] | |
>>> preferred_numbers(5) | |
[1.0, 1.58, 2.51, 3.98, 6.31] | |
>>> preferred_numbers(10) | |
[1.0, 1.26, 1.58, 2.0, 2.51, 3.16, 3.98, 5.01, 6.31, 7.94] |
NewerOlder