Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am joeybaker on github.
  • I am joeybaker ( on keybase.
  • I have a public key whose fingerprint is E79A 8CB3 BD26 FAF2 DE85 050C D111 C7BF 1E35 AF45

To claim this, I am signing this object:

View npm-should-install.patch
From c39e95ae6d41939e73568bea5782228d8590b953 Mon Sep 17 00:00:00 2001
From: Joey Baker <>
Date: Thu, 31 Mar 2016 11:17:44 -0700
Subject: [PATCH] Add: bin/should-install
Small script that warns if the dependencies are different from the last
time the script was run.
bin/lib/should-install.js | 61 +++++++++++++++++++++++++++++++++++++++++++++++
bin/should-install | 22 +++++++++++++++++
# strict mode
set -euo pipefail
function f () {
# set these to your server crt and key files
local crt=server.crt
local key=server.key
joeybaker / onbeforeunload.js
Created Oct 15, 2013
Show the user a warning before they leave the page if AJAX has yet to complete.
View onbeforeunload.js
// if the user attempts to navigate away from the page before ajax is complete, warn.
$.ajaxPrefilter(function(/*options, originalOptions, jqXHR*/) {
window.onbeforeunload = function(){
return 'Please allow ajax to complete'
// remove the warning when AJAX is done
window.onbeforeunload = void 0

We're going to refactor a library to make it more usable. The intention is to get the code to a point where it's a reusable component.

The library to refactor is:

ToDo List

This is a non-comprehensive list of things to do:

  • Convert to use jQuery instead of native browser code where possible
  • Add tests
  • Convert it UMD. Don't pollute the global scope.

Build a re-usable HTML component that allows a user to submit a bug report about the page they're viewing.

  • The client-side component should be standalone, and easily re-usable in wider app. It's okay to require a framework(s), but dependencies must be easy to manage.
  • Also build out a server that can receive these bugs, parse them, and send them to the Github API as new issues. You can use whatever server environment you'd like.
  • To enable the github API, you should probably create a new repo. Alternatively you can mock out the Github API responses.

You should build this as if you were going to put it into production: optimize for code quality over quantity, write tests as appropriate, and so on.

It's fine if you don't actually finish.

joeybaker / randomdata.json
Created Oct 1, 2013
just some random json data
View randomdata.json
"letters": "e",
"numbers": "10",
"colors": "Red"
"letters": "g",
"numbers": "19",
"colors": "Orange"
View umd.js
(function(window, factory) {
if (typeof exports === "object") {
// Node. Does not work with strict CommonJS, but only CommonJS-like
// enviroments that support module.exports, like Node.
module.exports = factory();
} else if (typeof define === "function" && define.amd) {
// Allow using this built library as an AMD module in another project. That
// other project will only see this AMD call, not the internal modules in
// the closure below.
joeybaker / gist:5454341
Created Apr 24, 2013
Feinstein on CISPA
View gist:5454341
Dear Mr. Baker:
Thank you for your letter concerning the "Cyber Intelligence Sharing and Protection Act" (H.R. 3523). I appreciate your taking the time to write and welcome the opportunity to respond.
The Cyber Intelligence Sharing and Protection Act was introduced in the House of Representatives on February 13, 2013 by Representative Mike Rogers (R-MI). The bill would, among other things, establish procedures to allow the Intelligence Community to share cyber threat intelligence with the private sector.
joeybaker /
Created Jan 23, 2013
change Livereload SASS and Compass to RVM versions
gem update sass
gem update compass
if [ -h "/Applications/" ]
sudo rm /Applications/
sudo mv /Applications/ /Applications/
if [ -h "/Applications/" ]