Skip to content

Instantly share code, notes, and snippets.

View traviskaufman's full-sized avatar

Travis Kaufman traviskaufman

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@traviskaufman
traviskaufman / index.html
Last active August 10, 2016 21:14
(Probably Bad) MDL v2 Ripple Prototype (alpha.2)
<section>
<button type="button" class="btn">A Thing</button>
<button type="button">Something else that can be focused</button>
</section>
@traviskaufman
traviskaufman / tips-for-coming-to-rust-from-javascript.md
Last active September 12, 2016 03:50
Tips for Coming to Rust from Javascript (WIP)

The following are tips I put together which I would have found helpful after coming to rust from Javascript.

NOTE: If you've never used a statically-typed programming language before, I highly recommend checking out Liz Baille's illustrated survival guide presentation from RustConf 2016.

I've been using Javascript both personally and professionally as my primary language. In many cases, even exclusively. However, I actually got my start in systems programming, writing really bad C code for MaxMSP, and it therefore has a special place in my heart.

Rust is like C, but way better. The rust team has essentially taken the complexity of designing a high-level language runtime and pushed it down the compiler. This is insanely impressive, and produces ridiculously incredible results. This is systems programming language with things like traits, generics, very intelligent type inference,

@traviskaufman
traviskaufman / MLPMnistSingleLayerExample.scala
Created October 25, 2016 01:54
dl4j's MLPMnistSingleLayerExample in Scala
/**
* @see https://github.com/deeplearning4j/dl4j-examples/blob/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/feedforward/mnist/MLPMnistSingleLayerExample.java
*/
import scala.collection.JavaConversions._
import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator
import org.deeplearning4j.eval.Evaluation
import org.deeplearning4j.nn.api.OptimizationAlgorithm
import org.deeplearning4j.nn.conf.NeuralNetConfiguration
@traviskaufman
traviskaufman / mdc-web-tape2mocha.js
Created February 16, 2017 21:09
one-off script to transform MDC-Web's tests from tape to mocha (https://github.com/material-components/material-components-web/issues/143)
/**
* @fileoverview one-off script to transform MDC-Web's tests from tape to mocha.
* See https://github.com/material-components/material-components-web/issues/143
*/
const fs = require('fs');
const path = require('path');
const babylon = require('babylon');
const glob = require('glob');
@traviskaufman
traviskaufman / mdc-web-closure-compatibility.md
Created February 22, 2017 16:30
MDC-Web Closure Compatibility

material-components/material-components-web#134

Closure Compiler Support

Google Closure Compiler support is required in order to support the Google projects and properties which are built around this toolchain. Concretely, MDC-Web must be able to compile with ADVANCED_OPTIMIZATIONS enabled, and produce no errors or warnings. There are implications for internal support as well, but that is outside the scope of this issue.

Goals

  • Full compilation of MDC-Web using ADVANCED_OPTIMIZATIONS
  • Test infrastructure to verify both compilation, as well as runtime correctness, e.g. our closurized code behaves correctly
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# ipython-utils/researchenv/__init__.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.core.interactiveshell import InteractiveShell
def load_ipython_extension(ipython: InteractiveShell):
print('%matplotlib inline')
# ipython-utils/setup.py
setup(
name='ipython-utils',
packages=find_packages(),
install_requires=[
'ipython >= 4',
'notebook >= 4.3.1',
'jupyter',
'numpy',
'pandas',
%%bq --name hn_daily_comment_counts
SELECT
TIMESTAMP_TRUNC(time_ts, DAY) as day,
COUNT(0) as comment_count
FROM
`bigquery-public-data.hacker_news.comments`
GROUP BY
day
ORDER BY
day ASC;