Skip to content

Instantly share code, notes, and snippets.

View johnsogg's full-sized avatar

Gabe Johnson johnsogg

View GitHub Profile
@johnsogg
johnsogg / Expr.g4
Created March 27, 2016 17:12
ANTLR4 semantic pred (sempred) example of Python-like context-sensitivity using JavaScript target
grammar Expr;
/*
Sample input should only have three statements in it, and should parse in a millisecond or three:
(1 +
2 *
(3 / 4 - 5
+ 7)
{
"points": [
{
"ID": 11192,
"X": 29.3592739,
"Y": -54.6364822
},
{
"ID": 11193,
"X": -6.36195946,
/*
example.go
This is a golang example of how to use SendGrid for transactional
email that uses substitutions (e.g. replace "firstName" with
"Grover"). It assumes you have a SendGrid API key.
I made this because I had to move away from Mandrill by April 27, and
SendGrid is basically across the street from me so they were the first
@johnsogg
johnsogg / longjob.go
Created August 11, 2017 18:43
Demonstration of how to coordinate many long-running goroutines using channels
package main
import (
"bufio"
"fmt"
"math/rand"
"os"
"time"
)
@johnsogg
johnsogg / hw2_help.md
Last active February 4, 2018 03:56
Note about data science hw 2

Help with Homework 2

Homework number 2 is crazy hard. The following hints should help.

Question 1

Q1 is about generating descriptive statistics with Numpy. If you're dealing with code that looks like np.something, you're using Numpy.

Important health tip: you have to execute each of the "In [ ]" blocks in order. Otherwise you'll get messages about things not being defined and so forth.

@johnsogg
johnsogg / map4.svg
Last active September 24, 2018 02:57
map4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johnsogg
johnsogg / tableThing.tsx
Created September 27, 2018 19:52
Typescript example of material-ui Table component
import {
createStyles,
Paper,
Table,
TableBody,
TableCell,
TableHead,
TableRow,
Theme,
withStyles,
@johnsogg
johnsogg / dataTable.tsx
Last active October 1, 2018 17:04
Material Design: How to maintain both type safety and styling with generic components
class DataTable<T> extends React.PureComponent<Props<T>, State> {
// nothing special about the implementation of DataTable. Just keep it
// unexported, because it will be exposed via the Wrapped thing below.
}
// If you have a component that takes type parameters and need to use 'withStyles', here is a
// way to maintain type safety:
//
// DataTable: Our custom component to wrap.
// T: Type parameter for DataTable
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
package-lock.json$