Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am joeybaker on github.
  • I am joeybaker (https://keybase.io/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:

From c39e95ae6d41939e73568bea5782228d8590b953 Mon Sep 17 00:00:00 2001
From: Joey Baker <joey@byjoeybaker.com>
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 +++++++++++++++++
#!/bin/bash
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
function f () {
# set these to your server crt and key files
local crt=server.crt
local key=server.key
@joeybaker
joeybaker / onbeforeunload.js
Created October 15, 2013 21:42
Show the user a warning before they leave the page if AJAX has yet to complete.
// 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
$(document).ajaxComplete(function(){
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: https://github.com/01miru/fileuploaderjs

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
joeybaker / randomdata.json
Created October 1, 2013 16:26
just some random json data
[
{
"letters": "e",
"numbers": "10",
"colors": "Red"
},
{
"letters": "g",
"numbers": "19",
"colors": "Orange"
(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.
define(factory);
@joeybaker
joeybaker / gist:5454341
Created April 24, 2013 18:25
Feinstein on CISPA
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
joeybaker / lrupdate.sh
Created January 23, 2013 21:56
change Livereload SASS and Compass to RVM versions
#!/bin/bash
gem update sass
gem update compass
if [ -h "/Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/sass" ]
then
sudo rm /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/sass
else
sudo mv /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/sass /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/sass.orig
fi
if [ -h "/Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass" ]