Skip to content

Instantly share code, notes, and snippets.

@jpommerening
jpommerening / itunes-countdown.sh
Created May 6, 2013 10:22
Get the current (estimation) of iTunes' 50 billion App countdown (see: http://www.apple.com/itunes/50-billion-app-countdown/)
#!/bin/sh
URL="${1:-http://www.apple.com/itunes/store/counters/il6ark7ec.js}"
JSON=`curl "$URL" 2>/dev/null`
getField () {
echo "$JSON" | sed 's/.*"'$1'" *: *\([0-9]\+\)[}, ].*/\1/p;d'
}
@jpommerening
jpommerening / npmbundle
Created June 28, 2013 23:14
Bundle any node package into a standalone package. At work, we need to be able to install node modules without network access. I decided to write a tiny script that bundles any npm package and all its dependencies into a TGZ that can be installed without access to the npm registry. Usage: npmbundle <package> It's just a quick hack, but it does t…
#!/usr/bin/env sh
set -e
tmpdir=`mktemp -d -t bundle`
file="package.json"
pushd "$tmpdir"
cat > "$file" <<EOF
@jpommerening
jpommerening / .vimrc
Created September 26, 2013 10:53
xclip from vim – I often find myself wanting to copy my vim selection to an X application. Vim has an optional feature for this (xterm_clipboard), but most installs come without the feature baked in. I could use the Shift-key when selecting, but that would copy my line numbers as well (and probably do other nasty things), so instead I wrote a li…
fun! Xclip() range
let l:_a = @a
exec a:firstline . ',' . a:lastline . 'yank a'
exec system('xclip', @a)
let @a = l:_a
endfun
" If you want to map this to Ctrl+c:
" vnoremap <C-c> :call Xclip()<cr>
@jpommerening
jpommerening / Gruntfile.js
Created April 10, 2014 10:03
grunt-karma PR #103
module.exports = function (grunt) {
function Explosion() {}
Explosion.prototype = new Error( 'Bam!' );
function initFramework( emitter ) {
emitter.on( 'browser_complete', function() {
throw new Explosion();
} );
}
@jpommerening
jpommerening / cssTransform.polyfill.js
Last active August 29, 2015 14:14
CSS transform polyfill (work in progress)
;(function(window, document, Math, undefined) {
var ORIGIN_PATTERN = /\s*(-?[0-9.]+)(%?)\s+(-?[0-9.]+)(%?)\s*/;
var TRANSFORM_PATTERNS = [
/(matrix)\(\s*(-?[0-9.]+)\s*,\s*(-?[0-9.]+)\s*,\s*(-?[0-9.]+)\s*,\s*(-?[0-9.]+)\s*,\s*(-?[0-9.]+)\s*,\s*(-?[0-9.]+)\s*\)/,
/(translate)\(\s*(-?[0-9.]+)\s*,\s*(-?[0-9.]+)\s*\)/,
/(rotate|skew[XY])\(\s*(-?[0-9.]+)(deg|g?rad|turn)\s*\)/,
/(scale)\(\s*(-?[0-9.]+)(%?)\s*(?:,\s*(-?[0-9.]+)(%?)\s*)\)/
];
var TRANSFORM_FUNCTIONS = {
matrix: function (v0, v1, v2, v3, dx, dy) {
@jpommerening
jpommerening / lru.js
Created October 9, 2015 09:08
a minimal lru structure for js
/**
* Create dead-simple LRU structure.
* @param {Number} size maximum number of items to be stored.
* @param {Object} [init] initial contents.
* @return {Object} the LRU object
*/
function LRU( size, init ) {
var items = init || Object.create( null );
var keys = Object.keys( items );
<style>
// Theming/Styling
.progress {
width: 100px;
height: 100px;
}
.progress .fill {
border: 8px solid orange;
width: calc(100% - 8px);

Keybase proof

I hereby claim:

  • I am jpommerening on github.
  • I am svckr (https://keybase.io/svckr) on keybase.
  • I have a public key whose fingerprint is 963C 704B 80B2 EB67 7B3D 9264 4130 4D03 41D4 5A7C

To claim this, I am signing this object:

@jpommerening
jpommerening / font-trace.js
Created September 27, 2016 09:59
svg letter tracing
const PHI = 1.6180339887498948;
const params = {
'font-size': 1,
'cap-height': 1,
'x-height': 1 / PHI,
'baseline': 0,
'ascender-height': 1.1,
'descender-height': 0.3,
@jpommerening
jpommerening / .procmailrc
Created March 20, 2017 13:27
Some procmail patterns
LOGFILE=$HOME/procmail.log
VERBOSE=on
MAILDIR=/var/spool/imap/$LOGNAME
DEFAULT=./
TOP=.
SP=" "
SPC="[$SP]"
NSPC="[^$SP]"