Skip to content

Instantly share code, notes, and snippets.

View workmajj's full-sized avatar

John J. Workman workmajj

View GitHub Profile
@workmajj
workmajj / three-boxes.md
Created July 10, 2016 03:41
A raw, representative sample of belongings, from moving
@workmajj
workmajj / smiley.c
Created September 16, 2015 04:31
Playing around with 2D graphics in 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 September 16, 2015 04:30
A quick (singly) linked list demo in C
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
char *str;
struct node *next;
} Node;
/* list */
@workmajj
workmajj / keybase.md
Created May 14, 2014 02:45
keybase.io

Keybase proof

I hereby claim:

  • I am workmajj on github.
  • I am workmajj (https://keybase.io/workmajj) on keybase.
  • I have a public key whose fingerprint is 8DF4 ACF5 25AA 32C5 171A 5C0F 554F DA51 E136 080A

To claim this, I am signing this object:

@workmajj
workmajj / blink.js
Last active December 20, 2015 20:29
A polyfill to resurrect the blink tag.
@workmajj
workmajj / apollo.js
Last active December 20, 2015 17:19
Steps for bulk downloading NASA Apollo images in the public domain.
// 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 December 11, 2015 19:48
Writing JS in object-literal style.
;(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 June 1, 2012 21:31
Fun with JS scope and first-class functions.
> 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 21:32
Quick and dirty scroll-to-top bookmarklet with easing.
// 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 September 30, 2011 19:47
Show number of Google results for a set of sites.
#!/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"