Skip to content

Instantly share code, notes, and snippets.

View eriwen's full-sized avatar

Eric Wendelin eriwen

View GitHub Profile
@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 / 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 / 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 / .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 / 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 / x
Created April 17, 2009 04:21
DZone command for Mozilla Ubiquity
CmdUtils.CreateCommand({
names: ["dzone", "dz"],
homepage: "http://eriwen.com/extras/dzone.html",
icon: "http://www.dzone.com/favicon.ico",
author: { name: "Eric Wendelin", email: "emwendelin@gmail.com" },
license: "GPL",
description: "Submit the current page to DZone",
help: "Running this command will submit the current page to DZone",
_title: function() {
@eriwen
eriwen / check_feedburner.py
Created November 4, 2009 21:30
check_feedburner.py
#!/usr/bin/env python
# Usage: ./check_feedburner.py MyFeedName
import re, sys, urllib, fileinput
from xml.dom import minidom
AWARENESS_API_URL = 'https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=%s'
# If you want to replace the feedburner count in a given file, define it here
FEED_COUNT_FILE = '/path/to/your/file.php'
@eriwen
eriwen / git_puller.sh
Created August 28, 2010 16:59
Git repo updater
#!/bin/bash
# Git repository updater | Spencer Tipping
# Run this from a cron job to update all repos on a regular basis.
for file in *; do
[[ -d $file && -d $file/.git ]] || continue
cd $file
${GIT:-git} pull >& /dev/null || echo "Failed to update $file: $(${GIT:-git} pull 2>&1)"
cd ..
done
@eriwen
eriwen / eriwen-static-build.xml
Created September 26, 2010 05:02
YUI Compressor ant build for static content
<project name="eriwen-static" default="prod" basedir=".">
<property name="src.dir" location="${basedir}/static" />
<property name="js.version" value="2" />
<property name="css.version" value="17" />
<target name="prod" depends="js.concatenate, js.minify, css.minify"
description="Full production build">
</target>
<target name="load.properties">
@eriwen
eriwen / array-extras.js
Created March 5, 2011 19:40
Playing around with implementing ES5 Array extras
/**
* Attach function to Array.prototype, with the given implementation.
*/
function augmentArrayPrototypeWith(func, impl) {
if (typeof Array.prototype[func] !== 'function') {
Array.prototype[func] = function() {
return impl.apply(this, arguments);
};
}
}