Skip to content

Instantly share code, notes, and snippets.

@michaelwills
michaelwills / README.md
Created December 11, 2015 02:33
JAWS (now) serverless/serverless handling of SNS events

@kfreytag responding to @Nopik

Responding to your question from early this morning about SNS-triggered lambdas. In my experience, you only get one message / Record at a time. Here’s my revised JAWS handler wherein I always deal with a JobId

@michaelwills
michaelwills / jquery-lodash-injector.js
Created December 10, 2015 10:38
Inject jquery and lodash into current page
javascript: (function () { var jv = '2.1.4'; var lv = '3.9.3'; var el = document.createElement('pre'), b = document.getElementsByTagName('body')[0], otherjQuery = false, msg = '', libs = [ function loadjQuery() { if (typeof jQuery != 'undefined') { showMsg('This page already using jQuery v' + jQuery.fn.jquery); } else { if (typeof $ == 'function') { otherjQuery = true; } getScript('//cdnjs.cloudflare.com/ajax/libs/jquery/' + jv + '/jquery.js', function () { if (typeof jQuery == 'undefined') { showMsg('Sorry, but jQuery wasn\'t able to load') } else { showMsg('This page is now jQuerified with v' + jQuery.fn.jquery + otherjQuery ? ' and noConflict(). Use $jq(), not $().' : ''); } }); } }, function loadLodash() { if (typeof _ != 'undefined') { showMsg('This page already using lodash v' + _.VERSION); } getScript('//cdnjs
@michaelwills
michaelwills / append-commit.js
Created December 9, 2015 10:43
append git commit to index.html with gulp
// http://stackoverflow.com/a/27084400
var gulp = require('gulp'),
git = require('gulp-git'),
cheerio = require('gulp-cheerio');
var gitHash;
gulp.task('hash', function(cb) {
return git.revParse({args:'--short HEAD'}, function(err, hash) {
@michaelwills
michaelwills / inject.js
Last active November 24, 2015 12:59 — forked from timnew/gist:3137257
Inject Javascript to current page
javascript:var s = 'http://code.jquery.com/jquery-1.7.2.min.js'; var b=document.body;if(b){void(z=document.createElement('script'));void(z.type='text/javascript');void(z.src=s);void(b.appendChild(z));}else{}
@michaelwills
michaelwills / csvds.py
Created November 12, 2012 05:32 — forked from fawce/csvds.py
Rough draft, CSV data source for zipline
"""
Generator-style DataSource that loads from CSV.
"""
import pytz
import csv
import mmap
import os.path
@michaelwills
michaelwills / SASS_rouded_corner_mixins.sass
Created June 19, 2012 06:14 — forked from victorbstan/SASS_rouded_corner_mixins.sass
SASS cross browser rounded corner mixins
$default_rounded_amount: 5px
// Round corner at position by amount.
@mixin round-corner($position, $amount: $default_rounded_amount)
border-#{$position}-radius: $amount
-webkit-border-#{$position}-radius: $amount
@mixin round-corner-mozilla($position, $amount: $default_rounded_amount)
-moz-border-radius-#{$position}: $amount
// Round left corners by amount
@michaelwills
michaelwills / $.fn.redraw.js
Created January 17, 2012 04:11 — forked from hdragomir/$.fn.redraw.js
Quick jQuery plugin to force element redraws
(function($){
$.fn.redraw = function(){
return $(this).each(function(){
var n = document.createTextNode(' ');
$(this).append(n);
setTimeout(function(){n.parentNode.removeChild(n)}, 0);
});
}
})(jQuery)
@michaelwills
michaelwills / makeapp.sh
Created January 6, 2012 16:20 — forked from demonbane/makeapp.sh
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name=$inputline
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url=$inputline
@michaelwills
michaelwills / gist:1075698
Created July 11, 2011 11:37 — forked from insin/gist:1031662
Boilerplate for serving a regular old HTML table as application/vnd.ms-excel, apropos acheiving Excel surround sound
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="expires" content="Mon, 06 Jan 1999 00:00:01 GMT">
<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
@michaelwills
michaelwills / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console