Skip to content

Instantly share code, notes, and snippets.

View JacobJohansen's full-sized avatar

Jacob Johansen JacobJohansen

View GitHub Profile
@JacobJohansen
JacobJohansen / getAnglurScopeInChrome.js
Created June 20, 2016 14:11
Get Angular Scope of selected element in chrom
angular.element($0).scope()
@JacobJohansen
JacobJohansen / getAnglurInjectorInChrome.js
Created June 20, 2016 14:12
get angular injector in chrome
var injector = angular.element(document.body).injector();
@JacobJohansen
JacobJohansen / index.html
Last active June 27, 2016 18:32 — forked from ZJONSSON/index.html
testing circles in Leaflet.js (working)
<!DOCTYPE html>
<html>
<head>
<title>Testing d3.js in Leaflet.js</title>
<link rel="stylesheet" href="leaflet.css"></link>
<script src="http://mbostock.github.com/d3/d3.v2.js?2.8.1"></script>
<script src="http://code.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<style type="text/css">
svg , g
@JacobJohansen
JacobJohansen / stormTopologyCheck.py
Created January 13, 2017 03:55 — forked from wesfloyd/stormTopologyCheck.py
Script runs constantly at X seconds interval checking to see if topologies have stopped processing new Tuples
# Wes Floyd April 2015
import sys
import requests
import json
import argparse
import pprint
import time
pp = pprint.PrettyPrinter(indent=4)
@JacobJohansen
JacobJohansen / host-manager
Created June 8, 2017 15:49 — forked from nddrylliog/host-manager
A command-line utility to manage the /etc/hosts file.
#!/bin/bash
# Idea and interface taken from https://github.com/macmade/host-manager
path="/etc/hosts"
addusage="Usage: `basename $0` -add host address"
remusage="Usage: `basename $0` -remove host"
case "$1" in
-add)
if [ $# -eq 3 ]; then
if [[ -n $(grep "^$3.*[^A-Za-z0-9\.]$2$" ${path}) ]]; then
#!/bin/sh
VERSION=0.8.0.0
BUILD_TYPE=debug
echo ============================
echo Set version $VERSION
echo ============================
TAG=$VERSION
python ./build/set_version.py $VERSION > ./src/version.h
@JacobJohansen
JacobJohansen / bankRoutingChecksum.js
Created November 1, 2017 13:25
Bank Routing Checksum; ABA Routing checksum; Clean
function isValidRoutingNumber(routingNum) {
var ABA_CHECKSUM_CONSTANTS = [3, 7, 1];
var ABA_CHECKSUM_DIVIDER = 10;
var ABA_LENGTH = 9;
var i = 0;
var checksum = 0;
if (isNaN(routingNum) || routingNum.length !== ABA_LENGTH) {
return false;
}
@JacobJohansen
JacobJohansen / webpack4upgrade.md
Created March 9, 2018 13:19 — forked from gricard/webpack4upgrade.md
Just some notes about my attempt to upgrade to webpack 4

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ webpack@4.0.0-beta.2
added 1 package, removed 20 packages and updated 4 packages in 13.081s

Cool! Ok...

@JacobJohansen
JacobJohansen / main.tf
Created March 7, 2019 15:16
terraform http provider to pull cloudflares ips and map them into an array
data "http" "cloudflare_ipv4" {
url = "https://www.cloudflare.com/ips-v4"
}
output "cloudflare_ip" {
value = "${split("\n",chomp(data.http.cloudflare_ipv4.body))}"
}
@JacobJohansen
JacobJohansen / inactivity.js
Created August 14, 2019 18:45 — forked from gerard-kanters/inactivity.js
Inactivity timeout javascript
<script type="text/javascript">
function idleTimer() {
var t;
//window.onload = resetTimer;
window.onmousemove = resetTimer; // catches mouse movements
window.onmousedown = resetTimer; // catches mouse movements
window.onclick = resetTimer; // catches mouse clicks
window.onscroll = resetTimer; // catches scrolling
window.onkeypress = resetTimer; //catches keyboard actions