Skip to content

Instantly share code, notes, and snippets.

View ithinkdancan's full-sized avatar

Daniel Tijerina ithinkdancan

  • H-E-B Digital
  • Austin, TX
View GitHub Profile
@ithinkdancan
ithinkdancan / dataByTypename.ts
Last active November 27, 2021 17:48
Helper util for pulling union GQL types into named objects based on their __typename
/* based on https://github.com/artsy/artsy.github.io/issues/495#issuecomment-509697859 as https://artsy.github.io/blog/2018/10/19/where-art-thou-my-error/ */
type OfUnion<T extends { __typename: string }> = {
[P in T['__typename']]: Extract<T, { __typename: P }>;
};
const dataByTypename = <T extends { __typename: string }>(data?: T): OfUnion<T> => {
const typedData = data
? {
[data.__typename]: data,
@ithinkdancan
ithinkdancan / render.js
Created March 21, 2019 14:20
Server Rendering
import url from 'url';
import { get, includes, isNumber, omit } from 'lodash';
import { bindActionCreators } from 'redux';
import { matchPath } from 'react-router-dom';
import { flushChunkNames } from 'react-universal-component/server';
import flushChunks from 'webpack-flush-chunks';
import BodyClassName from 'react-body-classname';
import Helmet from 'react-helmet';
import uuidv4 from 'uuid/v4';
import createStore from 'store/create';
@ithinkdancan
ithinkdancan / App.js
Last active March 20, 2019 20:26
RxJSpringHooks
import React, { useState, useEffect } from 'react';
import classnames from 'classnames';
import { useSpring, useTransition, animated } from 'react-spring'
import { isAfter, subSeconds } from 'date-fns';
import { sumBy, orderBy } from 'lodash';
import tweetService from './services/tweetService';
import './App.css';
export default function App({ tweetStream }) {
[alias]
alias = config --get-regexp alias
ec = config --global -e
st = status
co = checkout
cob = checkout -b
up = pull --rebase upstream master
pb = !git push --set-upstream origin "$(git rev-parse --abbrev-ref HEAD)"
db = !f() { git branch -d $1; git push origin :$1; }; f
cm = !git add -A && git commit -m
{
"caniuse.enabled": false,
"css.autoInsertVendorPrefixes": false
}
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
@ithinkdancan
ithinkdancan / snippets.cson
Last active June 30, 2017 23:33
web-redux snippets
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#