Skip to content

Instantly share code, notes, and snippets.

gwillz

View GitHub Profile
@gwillz
gwillz / draft-js-plugins.d.ts
Created Jul 5, 2018
Naive TypeScript support for draft-js-plugins
View draft-js-plugins.d.ts
/// <resources type="react" />
/// <resources type="draft-js" />
declare module "draft-js-plugins-editor" {
export type PluginsEditorProps = Draft.EditorProps | {
plugins: any,
}
export default class PluginsEditor
extends React.Component<PluginsEditorProps, Draft.EditorState> {}
@gwillz
gwillz / react-leaflet.d.ts
Last active Aug 23, 2018
React-Leaflet type definitions for v2.0 (extension for existing @types/react-leaflet)
View react-leaflet.d.ts
import * as React from 'react'
import * as L from 'leaflet'
import 'react-leaflet'
declare module 'react-leaflet' {
export interface LeafletContext {
map?: L.Map,
pane?: string,
View connect-static-file.d.ts
declare module 'connect-static-file' {
import {Handler} from 'express'
import {SendOptions} from 'send'
interface Options extends SendOptions {
encoded?: string;
headers?: {[key: string]: string};
}
View shm-typed-array.d.ts
/// <reference types="node" />
type Shm<T> = (T & { key: number });
type ShmMap = {
Buffer: Shm<Buffer>;
Int8Array: Shm<Int8Array>;
Uint8Array: Shm<Uint8Array>;
Uint8ClampedArray: Shm<Uint8ClampedArray>;
Int16Array: Shm<Int16Array>;
@gwillz
gwillz / moment-tags.js
Last active Sep 27, 2018
ES6 tagged template string for inline date fomatting
View moment-tags.js
/**
* This doesn't _need_ to use moment.
* It's just the library that this project is using.
* Luxon or date-fns could also drop in neatly.
*/
const moment = require('moment')
// This a bad name, as is 'format', so idk.
function inline(literals, ...parts) {
let join = '';
You can’t perform that action at this time.