Skip to content

Instantly share code, notes, and snippets.

Thomas Reynolds tdreyno

Block or report user

Report or block tdreyno

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View TasksLoading.ts
export function loadStories(userId: string) {
return Task.map2(
myStories => storiesSharedWithMe =>
({
myStories,
storiesSharedWithMe,
}),
userStories(userId).map(listToLookup),
userSharedStories(userId).map(listToLookup),
@tdreyno
tdreyno / andThen.ts
Last active Oct 23, 2019
It's like map, but you get the whole list.
View andThen.ts
interface Array<T> {
andThen: <U>(this: T[], fn: (items: T[]) => U) => U;
}
Array.prototype.andThen = function<T, U>(this: T[], fn: (items: T[]) => U): U {
return fn(this);
};
View 1-demo.ts
// Vector of number types
const v1 = vector([1, 2, 3, 4]);
console.log(v1.toString());
// Vector of string types
const v2 = vector(["a", "b", "c", "d"]);
console.log(v2.toString());
// Vector of vector types
View button.tsx
import React from 'react';
import { stylesheet, css } from '../../util';
import {
MEDIUM_COLOR,
LIGHT_PRIMARY_TEXT_COLOR,
BUTTON_LINK_TYPE,
LIGHT_COLOR,
} from '../../styles';
const STYLES = stylesheet({
View cssInJS.ts
import {
StyleSheet,
css as stylesheetToClassNames,
} from 'aphrodite';
import { Map } from 'immutable';
const Prefixer = require('inline-style-prefixer');
import { DEVELOPMENT } from '../config';
const prefixer = new Prefixer({ userAgent: navigator.userAgent });
View tslint.json
{
"rules": {
"align": [true, "parameters", "statements"],
"arrow-parens": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
View gist:ab5431caabaddc907e1dbbec4ec141a6
const country = (seg) => /^[a-z]{2}$/.test(seg);
const midPrefix = (seg) => /^m|g$/.test(seg);
const midValue = (seg) => /^[a-zA-Z0-9_]+$/.test(seg);
const coMidPrefix = (seg) => /^m|g$/.test(seg);
const coMidValue = (seg) => /^[a-zA-Z0-9_]+$/.test(seg);
const darkNews = (seg) => seg === DARK_LABEL;
const year = (seg) => /^[0-9]{4}/.test(seg);
const month = (seg) => /^[0-9]{2}/.test(seg);
const day = (seg) => /^[0-9]{2}/.test(seg);
View keybase.md

Keybase proof

I hereby claim:

  • I am tdreyno on github.
  • I am tdreyno (https://keybase.io/tdreyno) on keybase.
  • I have a public key whose fingerprint is 0D56 40C3 629D 4F02 3108 0B9B 5DD3 A3D3 D928 68DE

To claim this, I am signing this object:

@tdreyno
tdreyno / DataModel.js
Created Feb 23, 2015
Google I/O 2015 Experiment Data Serializer
View DataModel.js
var PIXI = require('pixi.js/bin/pixi.dev.js');
/**
* Data model and serialization.
*/
module.exports = (function() {
'use strict';
/**
* URL-safe character mapping.
View gist:90fdf6e9f7ca2cf4f427
header: {
childrenGenerator: [
{ component: Sorter, options: {
options: _ => TeamStore.getAllSorted(),
value: _ => this.state.team,
stringKey: "name",
modifier: "-large -float",
onChange: _ => this.handleTeamChange,
showAll: "Instrument" } },
You can’t perform that action at this time.