Skip to content

Instantly share code, notes, and snippets.

View eriwen's full-sized avatar

Eric Wendelin eriwen

View GitHub Profile
@eriwen
eriwen / new_gradle_repos.sql
Last active December 13, 2016 07:48
GitHub Archive stats for new Gradle and Maven repos over time
SELECT
CONCAT(STRING(YEAR(create_date)), LPAD(STRING(MONTH(create_date)), 2, '0')) AS create_month,
COUNT(DISTINCT project_name)
FROM (
SELECT
create_date,
LAST(SPLIT(repo_name, '/')) AS project_name -- (avoid forks)
FROM (
SELECT
repo_name,
@eriwen
eriwen / iterm_asciinema_profile.json
Created November 7, 2016 19:24
iTerm profile for Asciinema
{
"Working Directory" : "\/Users\/ewendelin",
"Prompt Before Closing 2" : 0,
"Selected Text Color" : {
"Green Component" : 0,
"Red Component" : 0,
"Blue Component" : 0
},
"Rows" : 25,
"Ansi 11 Color" : {
@eriwen
eriwen / buildSrc_build.gradle
Last active July 4, 2020 21:38
Minify individual files with Google Closure Compiler using Gradle
repositories {
mavenCentral()
}
dependencies {
compile localGroovy()
compile gradleApi()
compile ('com.google.javascript:closure-compiler:v20151015') {
exclude module: 'junit'
}
@eriwen
eriwen / isStrictMode.js
Created November 22, 2014 18:57
Return true if called from context within strict mode.
/**
* Return true if called from context within strict mode.
*/
function isStrictMode() {
return (eval("var __temp = null"), (typeof __temp === "undefined")); // jshint ignore:line
}
@eriwen
eriwen / .editorconfig
Created October 21, 2014 01:30
My .editorconfig
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
indent_style = space
@eriwen
eriwen / keybase.md
Last active August 29, 2015 14:06
Verifying myself on keybase.io

Keybase proof

I hereby claim:

  • I am eriwen on github.
  • I am eriwen (https://keybase.io/eriwen) on keybase.
  • I have a public key whose fingerprint is ACAA 6113 CB12 4F8F D37F 1B17 BE8F 9923 B6F7 A4CE

To claim this, I am signing this object:

@eriwen
eriwen / timing.js
Created August 23, 2014 17:41
Site Resource Timing
// Navigation Timing
var t = performance.timing,
pageloadtime = t.loadEventStart - t.navigationStart,
dns = t.domainLookupEnd - t.domainLookupStart,
tcp = t.connectEnd - t.connectStart,
ttfb = t.responseStart - t.navigationStart;
// Resource Timing
var r0 = performance.getEntriesByType("resource")[0],
loadtime = r0.duration,
@eriwen
eriwen / preparestacktrace.js
Created April 30, 2014 23:00
Error.prepareStackTrace idea
Error.prepareStackTrace = function(error, stack) {
var stackEntries = [];
for(var i = 1, len = stack.length; i < len; i++) {
var cur = stack[i];
// IDEA: utilize getEvalOrigin: if this function was created using a call to eval returns a CallSite object representing the location where eval was called
if (!cur.isNative()) {
stackEntries.push(new StackEntry(cur.getFunctionName(), cur.getFileName(), cur.getLineNumber(), cur.getColumnNumber()));
}
}
return stackEntries;
@eriwen
eriwen / t9-suffixtrie.js
Created January 28, 2014 22:18
Return a list of words from a given dictionary that match T9 (e.g. 2=ABC, 3=DEF) input using a suffix trie
/**
* Given an int[], dictionary of words, and function that returns letters corresponding to a number (as on a phone),
* return a list of possible words from the numbers given.
*/
var dictionary = ['FOO', 'BAR', 'BAY', 'BAZ', 'QUX'];
function parseT9(input, trie, partialWord, words) {
// Avoid Naive O(3^n) solution
if (!input.length) return words;
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");