Skip to content

Instantly share code, notes, and snippets.

View ats's full-sized avatar

Alan Schussman ats

View GitHub Profile
/* Processing code to display a grid overlay for help with layout */
Boolean doGrid = true; // enable or disable measurement grid
int divFactor = 25; // set square size of measurement grid
// display measurements grid if doGrid is true
if (doGrid == true) {
stroke(#3C4F50);
strokeWeight(1);
int vLines = width / divFactor;
# GitHub.tmbundle/Support/lib/gist.rb
# Modify def auth to use TM_GIT path
def auth
user = `$TM_GIT config --global github.user`.strip
token = `$TM_GIT config --global github.token`.strip
print user
user.empty? ? {} : { 'login' => user, 'token' => token }
end
/* May 1 2010
Processing code to read delimited data from a file and load columns
into arrays.
*/
BufferedReader reader;
String[] lines, row;
int i, j, sumColumn;
String[][] data = new String[7][32]; // adjust to array size
@ats
ats / babynames.r
Created May 2, 2010 23:06
Quick stab at tracking specific names in the baby names data
# 2010-05-02 baby name exploration
# data from http://github.com/hadley/data-baby-names/
bnames <- read.csv("~/data/data-baby-names/baby-names.csv") // path to data
library(ggplot2)
wantedNames <- c("Page", "Plant") // set a list of names to plot over time
gotNames <- subset(bnames, bnames$name %in% wantedNames)
p <- ggplot(gotNames, aes(x=year, y=percent*100))
@ats
ats / gist:1431723
Created December 5, 2011 00:04
Dirt-simple TextMate snippet for Markdown/Calepin header
Title: $1
Date: ${2:`date +%Y-%m-%d`}
Slug: ${3:post-slug}
Status: draft
$4
@ats
ats / gist:8499989
Created January 19, 2014 03:04
Bare-bones TextMate command to run the current markdown file through pandoc with a hardcoded LaTeX template.
#!/bin/bash
name="$TM_FILENAME"
barename="${name%.*}"
pandoc --read=markdown -s $TM_FILEPATH --output=$TM_DIRECTORY/$barename.pdf --template=$TM_DIRECTORY/template-tufte.tex --latex-engine=xelatex

Day One Today template

This creates a new entry with the following content in Day One. I run it via a Launch Center action:

# Today Template
## What is happening today? (work/home)
## What did I do yesterday?
## How do I feel?
## What is most valuable and concrete today? What action will advance the most important thing for me today?
@ats
ats / media-endpoint.php
Last active March 5, 2018 03:42 — forked from aaronpk/media-endpoint.php
an example of a Micropub Media Endpoint https://www.w3.org/TR/micropub/#media-endpoint
<?php
$token_endpoint = 'https://tokens.indieauth.com/token';
$base_url = 'https://media.prettygoodhat.com/';
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Authorization');
if(isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/plain') !== false) {
$format = 'text';
@ats
ats / Runkeeper_API_startup.md
Created May 8, 2013 04:00
Runkeeper API startup guide: I ran into some hitches with the Runkeeper API while building a plugin to hook it to Slogger, so I wrote a quick guide to accompany the plugin itself.

Runkeeper API startup

Begin with the Runkeeper Registration/Authorization page for general instructions to get started. This page points to the Application Portal you can use to establish your application. You'll obtain client_id and client_secret by registering a personal application in that portal.

Then obtain code by submitting a request to https://runkeeper.com/apps/authorize with the following parameters directly from the Runkeeper instructions:

  • client_id: The unique identifier that your application received upon registration
  • code: code
  • redirect_uri: The page on your site where the Health Graph API should redirect the user after accepting or denying the access request
@ats
ats / mover.rb
Created April 27, 2013 21:48
Command-line tool for browsing, downloading and uploading using the mover.io API. Requires a move.io account, a linked storage space (i.e. a "connector" such as Dropbox) and private user API keys available with the mover.io account.
#!/usr/bin/ruby
# mover.rb
# general purpose utility for finding, getting and uploading files using the mover.io API.
# YAML config file is required in ~/.mover, contains API IDs and keys provided by mover.io. Example db.yaml:
# ---
# connector: mover_connector_ID
# app_id: mover_user_app_ID
# app_secret: mover_user_secret_key