Skip to content

Instantly share code, notes, and snippets.

@davidvanvickle
davidvanvickle / promises.js
Last active August 29, 2015 14:12
JS promises notes
// http://www.html5rocks.com/en/tutorials/es6/promises/
function get(url) {
// Return a new promise.
return new Promise(function(resolve, reject) {
// Do the usual XHR stuff
var req = new XMLHttpRequest();
req.open('GET', url);
req.onload = function() {
@davidvanvickle
davidvanvickle / linkfilter.htm
Created January 13, 2015 20:11
turn html a tags into csv data
<!DOCTYPE html>
<html>
<head>
<title>Filter</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
</head>
<body>
<div id="proc"><p><a href="http://www.oscars.org/hollywoodcostume/" target="_blank">Academy of Motion Picture Arts and Sciences</a> <br><a href="http://annenbergphotospace.org/" target="_blank">Annenberg Space for Photography</a> <br><a href="http://www.armoryarts.org/" target="_blank">Armory Center for the Arts</a> <br><a href="http://www.caamuseum.org/" target="_blank">California African American Museum</a> <br><a href="http://californiasciencecenter.org/" target="_blank">California Science Center</a><br><a href="http://camla.org/" target="_blank">Chinese American Museum</a>&nbsp;<br><a href="http://www.cafam.org/" target="_blank">Craft Folk &amp; Art Museum</a> <br><a href="http://www.fowler.ucla.edu/" target="_blank">Fowler Museum at UCLA</a> <br><a href="http://www.getty.edu/visit/center/" target="_blank">The Getty Center</a> <br><a href="http:
@davidvanvickle
davidvanvickle / tally-table-vals.htm
Created January 14, 2015 19:32
tally table vals
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice 4.1.1 (Unix)">
<META NAME="CREATED" CONTENT="0;0">
<META NAME="CHANGED" CONTENT="0;0">
@davidvanvickle
davidvanvickle / counterclockify.js
Created September 18, 2015 22:13
If an array of coordinates is clockwise, convert it to counterclockwise.
/*
Make coordinates counter-clockwise
http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-points-are-in-clockwise-order
(x2-x1)(y2+y1)
point[0] = (5,0) edge[0]: (6-5)(4+0) = 4
point[1] = (6,4) edge[1]: (4-6)(5+4) = -18
@davidvanvickle
davidvanvickle / laravelhomestead.sh
Last active October 17, 2015 18:29
Laravel Homstead install notes
# get a homestead box
vagrant box add laravel/homestead
# clone homestead and go into it
git clone [email protected]:laravel/homestead.git
cd homestead
# put composer into it
curl -sS https://getcomposer.org/installer | php
function goodbye(e) {
if(!e) e = window.event;
//e.cancelBubble supported by IE - this will kill the bubbling process.
e.cancelBubble = true;
e.returnValue = 'You sure you want to leave?';
//This is displayed on the dialog
//e.stopPropagation works in Firefox.
if (e.stopPropagation) {
e.stopPropagation();
@davidvanvickle
davidvanvickle / find-changes.sh
Created June 26, 2017 15:20
find local repo changes from base project directory
#!/bin/bash
for d in */ ; do
echo "-- $d --"
cd $d
git status -s
cd ..
done