Skip to content

Instantly share code, notes, and snippets.

💥
Boom!

Ian Langworth ☠ statico

💥
Boom!
View GitHub Profile
@statico
statico / Dockerfile
Created Mar 9, 2020
Single server prototyping with docker-compose + nginx
View Dockerfile
# Remember that additional env vars can be in a .env, which docker-compose
# uses when building the image.
FROM node:12.9.0-alpine AS base
VOLUME /usr/local/share/.cache/yarn
COPY ./ /app/
WORKDIR /app/
RUN npm install --silent --global yarn
RUN yarn install --pure-lockfile --non-interactive
@statico
statico / .dockerignore
Created Mar 4, 2020
TypeScript + Apollo monorepo config
View .dockerignore
.DS_Store
.env
.vscode
Dockerfile
docker-compose.yml
frontend/.next
frontned/out/
node_modules
npm-debug.log*
yarn-debug.log*
@statico
statico / google-hire-to-csv.js
Last active Apr 7, 2020
Google Hire data export to useful CSV
View google-hire-to-csv.js
// This is free and unencumbered software released into the public domain.
const csv = require('fast-csv')
const dir = process.argv[2]
if (!dir) {
throw new Error('usage: export.js <export-dir>')
}
// Raw data from Google Hire export
@statico
statico / 00_statico.link_README.md
Last active Jul 7, 2020
Ian's Personal Short Link Bookmark Service
View 00_statico.link_README.md
@statico
statico / readme.md
Last active Apr 17, 2019
Zelda BotW icon export for Slack emoji
View readme.md
  1. Go to https://zelda.gamepedia.com/Items_in_Breath_of_the_Wild and "Save as Web Page" with Chrome
  2. In a new folder, cp ../*/*BotW_*png .
  3. Use rename to rename all the files, hopefully keeping the larger version of all files: rename -f '$_=lc $_; s/botw\W//g; s/\d+px.//i; s/_Icon//i; s/_/-/g; s/^(botw-)?/botw-/; s/[^\w.-]+//g; s/-+\.png/.png/' *
  4. Resize to 128x128px max with ImageMagick: mogrify -resize '128x128>' *.png
  5. Upload with the neutral-face-emoji-tools Chrome extension, possibly merging in https://github.com/Fauntleroy/neutral-face-emoji-tools/pull/15 to rate limit uploads
@statico
statico / streaming-csv-writer.ts
Created Mar 8, 2019
Streaming CSV Writer / TypeScript
View streaming-csv-writer.ts
import * as stringify from 'csv-stringify/lib/sync'
import * as fs from 'fs-extra'
import { Writable } from 'stream'
import * as tempy from 'tempy'
// Stringifies and writes a row at a time to disk. Call close() when finished to
// get the path to a temporary file where the CSV was written. You are
// responsible for deleting that file when finished.
export class StreamingCSVWriter {
private count: number
@statico
statico / data.ts
Created Mar 8, 2019
Get a Google Sheet using NodeJS async and TypeScript and Service Account credentials
View data.ts
import * as fs from 'fs-extra'
import { google } from 'googleapis'
import * as pathlib from 'path'
const getSheet = async (
keyFile: string,
spreadsheetId: string,
range: string
): Promise<string[][]> => {
const auth = await google.auth.getClient({
@statico
statico / circleci.yml
Created Jan 21, 2019
Node.js 10 + PostgreSQL CircleCI config
View circleci.yml
version: 2
workflows:
version: 2
build:
jobs:
- test
jobs:
test:
@statico
statico / ...README.md
Last active Feb 7, 2019
Knex & TypeScript
View ...README.md

Goals

  • Make all parts of Knex TypeScript-safe
@statico
statico / ...README.md
Last active Feb 7, 2019
Top-level monorepo TypeScript/JavaScript style with tslint and Prettier
View ...README.md

Goals

  • A single style for our projects and others
  • Minimize customization - Any decided-upon style is better than one we can bikeshed
  • Minimize friction - Instead of warnings, sources are formatted automatically on commit and on save inside your editor
  • Minimize files - These three or four files need only be at the top level of the monorepo... nothign in the subdirs

Why X?

  • Prettier, no semicolons - Because you don't need them and they add unnecessary visual clutter. Prettier will figure out when they're needed for you.
You can’t perform that action at this time.