Skip to content

Instantly share code, notes, and snippets.

View traviskaufman's full-sized avatar

Travis Kaufman traviskaufman

View GitHub Profile
@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
@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 / 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 / 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 / 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>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@traviskaufman
traviskaufman / merge-intervals.js
Last active May 14, 2020 17:06
Merge Intervals - O(n) average case time rather than THETA(nlogn)
// See: http://www.programcreek.com/2012/12/leetcode-merge-intervals/
console.log(mergeIntervals([[1,3],[2,6],[8,10],[15,18]]));
console.log(mergeIntervals([[1,8], [2,10], [3,6]]));
console.log(mergeIntervals([[1,8], [2, 8], [3, 6]]));
function mergeIntervals(intervals) {
if (intervals.length < 2) {
return intervals;
}
@traviskaufman
traviskaufman / group-rename-yosemite-translation.md
Created May 2, 2015 13:41
(Translation) How to Easily Rename a Group of File on OS X Yosemite

This is an english translation of http://www.guideitech.com/apple/come-rinominare-facilmente-un-gruppo-di-file-su-os-x-yosemite/ While I translated it mostly to practice my Italian, it's a great article and shows a cool feature on Yosemite if you don't want to deal with doing this at the command line :) Also please let me know if you find any mistakes or bad translations!

How to rename a group of files on OS X Yosemite

I’m sure there are hundreds of unorganized files on your macs right this moment. Vacation photos, PDF documents, downloads, TV series, or whatever. The first step in organizing these contents is to give them proper names.

@traviskaufman
traviskaufman / hapi-i18n.js
Created February 12, 2015 03:33
Minimal i18n plugin for HapiJS using node-i18n
'use strict';
import _ from 'lodash';
import i18n from 'i18n';
import {version} from '../../package.json';
registerI18n.attributes = { name: 'i18n', version };
export default registerI18n;
@traviskaufman
traviskaufman / logback_disable_in_unit_tests.md
Last active March 20, 2023 08:38
Logback: Disable all logging in unit tests

After scouring the internet and piece-mealing together the correct way to do this, here is a step-by-step, all-in-one-place guide to making logback STFU when running your unit tests.

Here's how to do it

Save the following as logback-test.xml under src/test/resources:

<configuration>
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
      <pattern>%msg%n</pattern>