Skip to content

Instantly share code, notes, and snippets.

View killtheliterate's full-sized avatar

Garrett Dawson killtheliterate

View GitHub Profile
@killtheliterate
killtheliterate / index.js
Last active September 23, 2023 05:38
requirebin sketch
var EventEmitter = require('events')
var Rx = require('rxjs')
var observableSocket = require('observable-socket')
function makeSocketLoop (emitter) {
const websocket = new WebSocket('wss://echo.websocket.org')
function onOpen () {
emitter.emit('open', websocket)
@killtheliterate
killtheliterate / gist:5646655
Last active April 8, 2020 17:37
Mixin for applying svg sprites with png fallback. $icon-sprites adheres to the compass sprites naming convention, so be mindful that "icon" is dependent on your directory structure and names. See http://bit.ly/15yEcAW
@killtheliterate
killtheliterate / gpg-agent.conf
Created March 11, 2016 03:36
Setting up gpg-agent
# There are some issues with pinentry, so I've just installed the relevant pinentry program
# mac: `brew install pinentry-mac`
# ubuntu: `sudo apt-get install pinentry-gnome3`
pinentry-program /usr/local/bin/pinentry-mac
enable-ssh-support
write-env-file
use-standard-socket
default-cache-ttl 600
max-cache-ttl 7200
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>
type Subtract<T, K> = Omit<T, keyof K>
export type EffOptions = {
ErrorComponent?: React.ComponentType<any>
LoadingComponent?: React.ComponentType<any>
log?: (...args: any[]) => void
}
export type EffProps = {
@killtheliterate
killtheliterate / hoc.tsx
Last active June 13, 2018 20:45
Spread operator loses type information
import * as React from 'react'
import { shallow } from 'enzyme'
// ---------------------------------------------------------------------------
export type HocProps = {
a: boolean
b: boolean
}
@killtheliterate
killtheliterate / effect.tsx
Last active June 13, 2018 20:34
A HOC for fetching data
// @see: https://gist.github.com/bvaughn/982ab689a41097237f6e9860db7ca8d6
import * as React from 'react'
// ---------------------------------------------------------------------------
export type EffOptions = {
StateComponent?: React.ComponentType<any>
}
Cool things folks heard about:
* Chrome 65:
* Highlights video - https://youtu.be/D1pV7ermy6w
* Emberconf
* React 16.3 - React.Suspense, React.Context
* Everybody hates Redux?
* D3 5
@killtheliterate
killtheliterate / package.json
Created December 13, 2017 21:33
More debugging
{
"name": "chassis",
"version": "0.0.1",
"description": "A component library for Blinker",
"private": true,
"main": "chassis.bundle.js",
"scripts": {
"build": "./bin/build",
"clean": "./bin/clean",
"lint": "./node_modules/.bin/eslint src/",
@killtheliterate
killtheliterate / webpack.config.js
Created December 13, 2017 21:06
For debugging.
// ---------------------------------------------------------------------------
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
// ---------------------------------------------------------------------------
const Router = require('koa-router')
const body = require('koa-body')
const fs = require('fs')
const router = new Router()
const BASE_URL = '/upload'
router.put(BASE_URL, body({ multipart: true }), async (ctx) => {
const files = ctx.request.body.files
const keys = Object.keys(files)