Skip to content

Instantly share code, notes, and snippets.

@jcla1
jcla1 / drawArrow.js
Created December 18, 2012 20:45
Drawing an arrow in JS can be hard!
function drawArrow(x, y, w, h, rot) {
ctx.save();
ctx.translate((x + w / 2), (y + h / 2));
ctx.rotate(rot);
ctx.translate(-(x + w / 2), -(y + h / 2));
ctx.translate(x, y);
a = 0;
@jcla1
jcla1 / Arrow.coffee
Created December 19, 2012 17:32
Pointing Arrow
class Arrow
constructor: (x, y, w, h, rot)->
@x = x
@y = y
@w = w
@h = h
@rot = rot
pointTo: (x, y) ->
m_y = @y - y
@jcla1
jcla1 / README.md
Last active December 10, 2015 06:48
On Ulam spirals and matrix generation (blog post)
@jcla1
jcla1 / time_coincidences.rb
Last active December 10, 2015 16:28
A little challenge @qmacro gave me, about time.
SECOND = 1
MINUTE = 60 * SECOND
HOUR = 60 * MINUTE
time = Time.new 0, 1, 1, 0, 0
end_time = Time.new 0, 1, 2, 0, 0
$coincidences = []
class Time
@jcla1
jcla1 / a.html
Created April 3, 2013 16:56 — forked from mbostock/.block
<!DOCTYPE html>
<html>
<body>
<div id="main">
<ul>
<li><b>Anteater</b></li>
<li><a href="b.html">Baobao</a></li>
<li><a href="c.html">Cuttlefish</a></li>
</ul>
Anteaters, also known as antbear, are the four mammal species of the suborder Vermilingua (meaning "worm tongue") commonly known for eating ants and termites. Together with the sloths, they compose the order Pilosa. The name "anteater" is also colloquially applied to the unrelated aardvark, numbat, echidna, and pangolin.
@jcla1
jcla1 / maumau.go
Last active December 21, 2015 21:19
Simple networked MauMau player in Go
package main
import (
"encoding/json"
"net/http"
)
type Turn struct {
Stack []string `json:"stack"`
Hand []string `json:"hand"`
#!/bin/sh
# computer activity data collection for http://jehiah.cz/one-two/
# initially by Jehiah Czebotar. Modified by Joseph Adams
FILE="data/misc/activity_log/`date +%Y%m%d`.log"
FRONT_APP="data/misc/cron/frontApp/frontApp.applescript"
function log_activity()
{
local UTC=`date "+%s,%Z"`
@jcla1
jcla1 / chrome_status.applescript
Last active December 22, 2015 20:19
Get the URL of Chrome's active tab.
tell application "System Events"
set chromeRunning to (length of (get name of every process whose name is "Google Chrome") is greater than 0)
set chromeInFocus to ((name of first application process whose frontmost is true) is "Google Chrome")
set activeURL to ""
set numTabs to 0
if chromeRunning then
tell application "Google Chrome"
set normalWindows to (windows whose mode is not "incognito")
@jcla1
jcla1 / running_programs.applescript
Last active December 23, 2015 00:29
Print a comma delimited list of user programs running, excluding Finder.
tell application "System Events"
set programs to get name of every process whose background only is false and name is not "Finder"
set AppleScript's text item delimiters to {","}
programs as string
end tell
@jcla1
jcla1 / .gitmodules
Last active December 23, 2015 01:48
Cron and Applescript files for personal tracking
[submodule "running_programs"]
path = running_programs
url = https://gist.github.com/6554497.git
[submodule "chrome_status"]
path = chrome_status
url = https://gist.github.com/6525572.git
[submodule "frontApp"]
path = frontApp
url = https://gist.github.com/6522769.git