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
const puppeteer = require('puppeteer'); | |
main(); | |
async function main () { | |
const browser = await puppeteer.launch({ headless: false }); | |
const page = await browser.newPage(); | |
await page.goto(`https://webpage.com`, { waitUntil: 'load' }); |
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
const { Pool } = require('pg'); | |
const connectionString = require('./connection-string.json'); | |
const pool = new Pool(connectionString); | |
async function main () { | |
const x = await pool.query('Select count(*) from my_table'); | |
console.log(x.rows); | |
} |
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
async function downloadPage (matches) { | |
for (let match of matches) { | |
const requestUrl = `tktk`; | |
const html = await wget(requestUrl); | |
} | |
} | |
async function wget (requestUrl) { | |
return new Promise((resolve, reject) => { | |
const cmd = `wget -q -O - '${requestUrl}'`; |
If you have any tips or areas to discuss, you can get in touch a few different ways:
- Keybase
- Email
- [email protected] (note: michael.keller@nytimes is not me so please don't send him email)
- Phone
- (212) 556-7148
- NY Times tips page
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
\copy (SELECT * FROM persons) to 'C:\tmp\persons_client.csv' with (format csv, header) |
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
const wait = ms => new Promise(f => setTimeout(f, ms)); | |
// wait(500) |
When creating a polylinear time scale, the tricky part is to know to which value in the range the intermediate dates should map.
Let's say we want to "zoom in" on 4 particular days and make them appear with the size of 10 days each. Because these days now take up more space (36 or (factor - 1) * n
), we need to create a linear time scale where the domain ends at 36 days later than we want to show. This scale is then used to determine the intermediary range values of the polylinear scale.
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 { Pool } from 'pg'; | |
export default function db (connectionString) { | |
const pool = new Pool(connectionString); | |
pool.on('error', err => { | |
console.error(err); | |
}); | |
return pool; |
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
<h1 style="opacity: 0.25;{color}">Hello {name}!</h1> | |
<script> | |
export default { | |
data () { | |
return { | |
color: 'color: #fc0;' | |
} | |
} | |
} |