Skip to content

Instantly share code, notes, and snippets.

Avatar

Cameron Desautels camdez

View GitHub Profile
@camdez
camdez / core.clj
Created Jul 30, 2017
Experimenting with extending Transit to truncate Doubles and Floats
View core.clj
(ns transit-ex-test.core
(:gen-class)
(:require [cognitect.transit :as transit])
(:import [java.io ByteArrayOutputStream]
[com.cognitect.transit.impl
WriteHandlers
WriteHandlers$DoubleWriteHandler
WriteHandlers$FloatWriteHandler]))
(defn truncate-double [^Double d]
@camdez
camdez / leaderboard.sh
Created Aug 24, 2016
Small Business App Showdown Leaderboard
View leaderboard.sh
#!/bin/bash
# leaderboard.sh - Small Business App Showdown leaderboard
#
# Author: Cameron Desautels <cameron@collbox.co>
# Date: 2016-08-24 13:09:48
DATA_URL='https://intuit.promo.eprize.com/v1/developer/contest/gallery.json?count=1000'
HIGHLIGHT='collbox'
curl $DATA_URL \
View map-table.clj
(defn table [cols vals]
(->> vals
(partition (count cols))
(map (partial zipmap cols))))
(defn table2 [cols & rest]
(map (partial zipmap cols) rest))
(table
[:this :that :another]
@camdez
camdez / breaktime.el
Last active Aug 29, 2015
/u/joeheyming's Emacs break timer (modified)
View breaktime.el
;;; See: https://www.reddit.com/r/emacs/comments/3icpo7/take_a_break_every_3_hours/
(defvar breaktime-timer nil
"Holds the running break timer (if any).")
(defvar breaktime-interval (* 3 60 60)
"How often to take a break, in seconds.")
(defun breaktime--take-a-break ()
(interactive)
(switch-to-buffer (get-buffer-create "*breaktime*"))
(let ((inhibit-read-only t))
@camdez
camdez / pairs.org
Last active Aug 29, 2015
Pairing Sessions
View pairs.org

Remote Pairing Sessions

I’m open to pairing programming with anyone on anything. I’m interested in exposure to other people’s coding / problem solving styles, and I’m happy to share what I know. Need another pair of eyes on something? Leave a comment below, or email me at camdez@gmail.com.

WhenWhoWhatWith
@camdez
camdez / experimental.el
Created May 6, 2015
Play sound in Emacs when mark is pushed. Interesting for discovering which commands push mark. (If not using OS X, insert appropriate sound file path.)
View experimental.el
;; $ ls /System/Library/Sounds/
;; Basso.aiff Bottle.aiff Funk.aiff Hero.aiff Ping.aiff Purr.aiff Submarine.aiff
;; Blow.aiff Frog.aiff Glass.aiff Morse.aiff Pop.aiff Sosumi.aiff Tink.aiff
(defun camdez/push-mark--play-sound (&optional location nomsg activate)
(play-sound-file "/System/Library/Sounds/Pop.aiff" 20))
(advice-add 'push-mark :after #'camdez/push-mark--play-sound)
@camdez
camdez / epigrams-on-programming.md
Last active Jul 4, 2020
Alan Perlis' "Epigrams on Programming"
View epigrams-on-programming.md

Epigrams on Programming

Alan J. Perlis, Yale University

This text has been published in SIGPLAN Notices Vol. 17, No. 9, September 1982, pages 7 - 13. I'm offering it here online until ACM stops me.

The phenomena surrounding computers are diverse and yield a surprisingly rich base for launching metaphors at individual and group activities. Conversely, classical human endeavors provide an inexhaustible source of metaphor for those of us who are in labor within computation. Such relationships between society and device are not new, but the incredible growth of the computer's influence (both real and implied) lends this symbiotic dependency a vitality like a gangly youth growing out of his clothes within an endless puberty.

The epigrams that follow attempt to capture some of the dimensions of this traffic in imagery that sharpens, focuses, clarifies, enlarges and beclouds our view of this most remarkable of all mans' artifacts, the computer.

@camdez
camdez / experimental.el
Last active Aug 29, 2015
Add new Emacs experiment
View experimental.el
(defun camdez/add-experiment ()
(interactive)
(find-file camdez/experiments-file)
(goto-char (point-min))
(re-search-forward ";;; Code:")
(insert "\n\n")
(camdez/lisp-insert-hr)
(insert ";; ")
(insert-date-and-time)
(insert "\n\n"))
View longhorn-version.el
(eval-after-load 'projectile
'(add-hook 'find-file-hook 'camdez/warn-if-longhorn-version))
(defun camdez/warn-if-longhorn-version ()
(interactive)
(when (projectile-project-p)
(let* ((file-name (buffer-file-name))
(project-dir (projectile-project-root))
(views-dir (concat project-dir "app/views/"))
(lh-views-dir (concat project-dir "app/longhorn_views/")))
View melpa-stable-add.yasnippet
# name: Request Addition to MELPA Stable
# key: melpa-stable-add
# uuid: 2776fd13-47f6-4438-902e-2f39c48fd790
# contributor: Cameron Desautels <camdez@gmail.com>
# --
Hi!
[MELPA Stable](http://stable.melpa.org/) is the new younger sibling of MELPA for users who'd rather run only stable versions of packages (MELPA can be a bit rocky since every commit comprises a new release), and it would be super cool if ${1:this package} could be installed via Stable.
Fortunately it's also really easy to support—all you have to do is define a tag in the \`v...\` format and you're done. I'd submit a PR if I could, but since tags are global to a project, that's not something possible via PR.
You can’t perform that action at this time.