Skip to content

Instantly share code, notes, and snippets.

View indianburger's full-sized avatar

Aravind Ramanathan indianburger

  • Twitter
  • San Francisco
View GitHub Profile
@indianburger
indianburger / custom-shrinkwrap.sh
Created January 17, 2017 01:09
Hack npm shrinkwrap to be ordered and more stable
#!/usr/bin/env bash
set -eu -o pipefail
npm_registry="https://internal-npm-registry..."
# Check environment, different npm versions package shrinkwrap differently.
node -v | grep --silent '5.8.0' \
|| { echo 'Failed. Expected version node v5.8.0 was not found.'; exit 1;}
npm -v | grep --silent '3.7.3' \
|| { echo 'Failed. Expected version npm 3.7.3 was not found.'; exit 1; }
@indianburger
indianburger / accessibility_audit.md
Last active May 20, 2016 18:08
Accessibility Audit

Here is how I did an accessibility audit

@indianburger
indianburger / index.html
Last active August 29, 2015 14:08
memory leaks
<button id="start">Start</button>
<script>
var button = document.getElementById('start');
var leaker = [];
button.addEventListener("click", function() {
for (var i = 0; i < 1000000; i++) {
leaker.push(document.createElement("div"));
}
});
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script>window.twttr = (function (d, s, id) {
var t, js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
@indianburger
indianburger / render-time.js
Created October 24, 2014 15:07
Render time using browser-perf
var browserPerf = require('browser-perf'),
statistics = require("simple-statistics"),
async = require("async"),
BaseMetrics = require('browser-perf/lib/metrics/BaseMetrics'),
url = process.argv[2],
options = {
selenium: 'http://localhost:9515',
browsers: ['chrome'],
actions: waitForRender,
metrics: [renderMetric()]
@indianburger
indianburger / slow-qunit.js
Created October 24, 2014 00:35
Print slow qunit tests
var tests = [];
var startTime;
QUnit.testStart(function() {
startTime = +new Date;
});
QUnit.testDone(function(obj) {
tests.push({
name: obj.name,
time: +new Date - startTime
@indianburger
indianburger / ntfy.sh
Last active August 29, 2015 14:07
notify after long running shell command
# 1. brew install terminal-notifier
# 2. Add this to your .bash_profile or .zshrc or wherever you shove your shell aliases
function ntfy() {
terminal-notifier -message "Completed with exit code $?"
}
#3. Use it. Use semicolon, not && so that it'll work with failed commands. E.g.
mvn clean test; ntfy
@indianburger
indianburger / email.js
Created July 8, 2013 20:19
Amazon SES: Sample code to send a really simple email using AWS SDK for node.js using SES service. Haven't tested this exact code, but used this in something that works.
var AWS = require('aws-sdk'),
sesEmailParams,
ses;
AWS.config.loadFromPath('./config.json'); //http://aws.amazon.com/sdkfornodejs/
ses = new AWS.SES();
sesEmailParams = {
Source: "amazon-verified@email.com", //verify sender email in aws console. More info here http://aws.amazon.com/ses/
Destination:{
ToAddresses: ["blah@test.com"]
},
@indianburger
indianburger / reviewboard_shipit.js
Created April 2, 2012 17:13
Reviewboard ship it bookmarklet
javascript:(function(){
$('#actions li:nth-child(2) > a').click();
setTimeout(shipIt,500);
function shipIt(){
$('#id_shipit').attr('checked','checked');
$('.modalbox-buttons input:first-child').click();
}
})();