Skip to content

Instantly share code, notes, and snippets.

Nathan Smith nathansmith

Block or report user

Report or block nathansmith

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

There is a cult of ignorance in the United States, and there always has been. The strain of anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that "my ignorance is just as good as your knowledge."

— Isaac Asimov



This past week a bunch of us from InVision were at a minor league hockey game in Austin.

I was waiting in line at one of the restaurants, just outside the arena entrance. I got to the front of the line, and was about to order, when the national anthem could be heard from inside the arena.

I look up from the menu, and notice that the entire staff is standing still, smiling, with their hands over their hearts. Realizing that the national anthem is being played, I do the same.

My coworker (from Europe) is to my immediate right, in front of another cash register, and he's also begun looking up from his menu.

Coworker: "Hmm, I think I would like to order the…"

nathansmith /
Last active Jan 6, 2019
Command line snippet to lock icons at "48" size.
nathansmith / dribbble_console_follow.js
Created Nov 1, 2018
Leave this running on your "" page, to auto-follow everyone back.
View dribbble_console_follow.js
// ==================
// Scroll page timer.
// ==================
setInterval(function() {
// NOT end of page?
if (!$('.null-message').length) {
// Get offset.
var offset = document.body.scrollHeight
nathansmith / get_parents_example.ts
Last active Nov 13, 2018
TypeScript example, for a friend. Explaining types, interfaces, and tuples.
View get_parents_example.ts
// Possible `gender` values.
type Gender = 'male' | 'female' | 'other'
// Generic `person` interface.
interface IPerson {
// Specific string.
gender: Gender
// Any string.
name: string
View get_siblings.js
// Gets siblings of element.
const getSiblings = (el) => {
// Array method.
const f = Array.prototype.forEach
// Get children.
const children = el.parentNode.children
// Set in loop.
const siblings = []
nathansmith / query_splitter.js
Last active Aug 17, 2018
This method splits apart a query string and converts it into an regular object.
View query_splitter.js
This method splits apart a
query string and converts
it into an regular object.
const querySplitter = (url = '') => {
// Split apart.
const parts = url.split('?')
const query = parts[1] || parts[0]
const pairs = (query || '').split('&')
nathansmith / on_event.js
Last active Apr 14, 2018
Event delegation helper.
View on_event.js
// Used like so:
onEvent('click', '.foo', (el) => {
// Element that was clicked.
// Event delegation helper.
const onEvent = (event, selector, f) => {
nathansmith / .eslintrc.json
Last active Apr 18, 2018
My ESLint options file.
View .eslintrc.json
"extends": [
"globals": {
"afterAll": true,
"afterEach": true,
"beforeAll": true,
"beforeEach": true,
nathansmith / apollo_query_and_mutation.js
Last active Aug 17, 2018
Example of Apollo's declarative "query" and "mutation" syntax.
View apollo_query_and_mutation.js
// Dependencies.
import React from 'react'
import PropTypes from 'prop-types'
import {Mutation, Query} from 'react-apollo'
// Mutations and queries.
import MY_MUTATION from './my_mutation'
import MY_QUERY from './my_query'
// UI components.
You can’t perform that action at this time.