Skip to content

Instantly share code, notes, and snippets.

John J. Workman workmajj

View GitHub Profile
@workmajj
workmajj / three-boxes.md
Created Jul 10, 2016
A raw, representative sample of belongings, from moving
@workmajj
workmajj / blink.js
Last active Dec 20, 2015
A polyfill to resurrect the blink tag.
View blink.js
@workmajj
workmajj / apollo.js
Last active Dec 20, 2015
Steps for bulk downloading NASA Apollo images in the public domain.
View apollo.js
// 0. open url: http://www.apolloarchive.com/apollo_gallery.html
// (n.b. all images to be downloaded are in the public domain)
// 1. install jquery by running this snippet in the console:
var s = document.createElement('script');
s.src = 'https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js';
(document.getElementsByTagName('head')[0] ||
document.getElementsByTagName('body')[0]).appendChild(s);
@workmajj
workmajj / object-literal.js
Last active Dec 11, 2015
Writing JS in object-literal style.
View object-literal.js
;(function(window, undefined) {
'use strict';
var SomeObj = function(opts) {
if (opts.whatever) this.isWhatever = true;
// do some constructor stuff
this.init(opts.thing);
};
@workmajj
workmajj / fun.js
Created Jun 1, 2012
Fun with JS scope and first-class functions.
View fun.js
> var foo = function() { return foo; }
undefined
> foo
function () { return foo; }
> foo()
function () { return foo; }
> foo()() === foo()()()()()()()()
@workmajj
workmajj / scroll-to-top.js
Created May 22, 2012
Quick and dirty scroll-to-top bookmarklet with easing.
View scroll-to-top.js
// full-source version:
javascript:(function(win) {
var STEP_SIZE = 200; // px
var DELAY = 20; // ms
var ease = function(scrollTop) {
if (scrollTop <= STEP_SIZE) {
win.scroll(0, 0);
@workmajj
workmajj / google-results.sh
Created Sep 30, 2011
Show number of Google results for a set of sites.
View google-results.sh
#!/usr/bin/env sh
# $ ./google-results.sh
# Fri Sep 30 15:43:01 EDT 2011|http://www.google.com/search?q=site:amazon.com|360,000,000
# Fri Sep 30 15:43:06 EDT 2011|http://www.google.com/search?q=site:apple.com|46,500,000
# Fri Sep 30 15:43:11 EDT 2011|http://www.google.com/search?q=site:facebook.com|2,600,000,000
# Fri Sep 30 15:43:16 EDT 2011|http://www.google.com/search?q=site:google.com|281,000,000
URLS=(
"http://www.google.com/search?q=site:amazon.com"
@workmajj
workmajj / brubeck-install.sh
Created Sep 18, 2011
Basic OS X install script for Brubeck.
View brubeck-install.sh
#!/usr/bin/env sh
# Brubeck install script cribbed from: http://brubeck.io/installing.html
# Version numbers and directories.
ZMQ_VERSION="2.1.9"
VIRTUALENVWRAPPER_SH="/usr/local/bin/virtualenvwrapper.sh"
VIRTUALENV_NAME="brubeck"
@workmajj
workmajj / smiley.c
Created Sep 16, 2015
Playing around with 2D graphics in C
View smiley.c
#include <assert.h>
#include <stdio.h>
#include <cairo.h>
#define PIXEL_SIZE 50
void draw_to_file(const char *filename)
{
assert(filename != NULL);
@workmajj
workmajj / ll.c
Created Sep 16, 2015
A quick (singly) linked list demo in C
View ll.c
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
char *str;
struct node *next;
} Node;
/* list */
You can’t perform that action at this time.