Skip to content

Instantly share code, notes, and snippets.

@awhitty
awhitty / README.md
Created March 11, 2019 20:56 — forked from lgersman/README.md
state diagram editor example based on (https://gist.github.com/lgersman/5311083)
  • Click into the drawing area to start the selection frame
  • move the mouse to resize the selection frame
  • Release the mouse button to resize the selection frame
  • circles are draggable
  • circles can be selected (multiple selections possible by pressing CTRL while clicking a circle)
  • the selection frame selects all circles within the frame (by pressing CTRL the selected circles will be appended to current selection)
  • multiple selected circles will be dragged simultaneous

new features:

@awhitty
awhitty / .block
Last active April 4, 2016 20:26 — forked from mbostock/.block
Choropleth
license: gpl-3.0
@awhitty
awhitty / send_ip.py
Last active February 10, 2016 08:46
Ideally sends the IP address of a raspberry pi to IFTTT Maker channel (untested), based on http://elinux.org/RPi_Email_IP_On_Boot_Debian
import subprocess
import requests
import json
MAKER_EVENT_TITLE = "raspi_connected"
MAKER_CHANNEL_KEY = "<your key>"
def connect_type(word_list):
""" This function takes a list of words, then, depeding which key word, returns the corresponding
internet connection type as a string. ie) 'ethernet'.
# Downloads all the tiles at full resolution from a directory of Zoomify tiles.
# Requires `eventlet` for multithreaded HTTP requests
import eventlet
from eventlet.green import urllib2
from math import floor, ceil, pow
BASE_URL = "http://www.theatlantic.com/media/interactives/2015/11/colorado-satellite-photo/tiles/"
DOWNLOAD_DIR = "tiles/"
@awhitty
awhitty / four.py
Created February 17, 2015 11:14
Four is magic!!!!!!!
import math
NUMBER_WORDS = {
1 : "one",
2 : "two",
3 : "three",
4 : "four",
5 : "five",
6 : "six",
7 : "seven",
@awhitty
awhitty / gist:8910661
Created February 10, 2014 05:09
Quickly toggling classes with Angular
<!-- Parent -->
<div ng-class="{true: ‘these classes when true’, false: ‘these classes when false’}[variable]">
<!-- Child -->
<button ng-click="variable = !variable">Toggle me bro</button>
</div>
<!-- Shorthand when just toggling visibility -->
<div ng-toggle="variable">
<!-- Child -->
<button ng-click="variable = !variable">Toggle me bro</button>
<html>
<head>
<title>Email Form</title>
</head>
<body>
<form action="">
<input type="text" placeholder="Email">
<input type="submit">
</form>
import ddf.minim.*;
Minim minim;
AudioInput in;
int counter;
void setup()
{
size(1024, 768, P2D);
@awhitty
awhitty / gist:4562484
Created January 18, 2013 05:07
Screen dotfiles to be placed in ~/.screenrc
# Disable the startup message
startup_message off
# create a status line at the bottom of the screen. this will show the titles and locations of
# all screen windows you have open at any given time
hardstatus alwayslastline "%{= dR} %-Lw%50>%{= dG}%n%f* %{= dW}%t%{= dR}%+Lw%<"
# bind some function keys (k1 == F1, etc) for fast navigation through screen windows
#
#
# use F8 to turn the status bar off at the bottom of the screen
bindkey -k k8 hardstatus alwayslastline
@awhitty
awhitty / gist:4212047
Created December 5, 2012 03:55
Nice Hex Colors
NICE GRAYS
----------------------------
black: #000
darker gray: #222
dark gray: #333
gray: #555
light gray: #999
lighter gray: #eee
white: #fff