Skip to content

Instantly share code, notes, and snippets.

View camdez's full-sized avatar

Cameron Desautels camdez

View GitHub Profile
(ns zip-file-entries
(:require
[clojure.java.io :as io])
(:import
(java.io BufferedInputStream ByteArrayOutputStream)
(java.util.zip ZipInputStream)))
(defn zip-file-seq [^ZipInputStream zin]
(when-let [entry (.getNextEntry zin)]
(if (.isDirectory entry)
@camdez
camdez / epigrams-on-programming.md
Last active January 10, 2024 18:35
Alan Perlis' "Epigrams on Programming"

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 / card_game.clj
Last active November 19, 2023 06:40
Example code shape for a functional card game in Clojure
(ns card-game
(:require [clojure.string :as str]))
(def deck
(for [suit ["♣" "♦" "♥" "♠"]
rank ["1" "2" "3" "4" "5" "6" "7" "8" "9" "J" "Q" "K" "A"]]
(str rank suit)))
(defn new-game [player-count hand-size]
{:deck deck
@camdez
camdez / core.clj
Created July 30, 2017 21:09
Experimenting with extending Transit to truncate Doubles and Floats
(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]
# 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.
@camdez
camdez / leaderboard.sh
Created August 24, 2016 18:20
Small Business App Showdown Leaderboard
#!/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 \
//
// UIView+Hierarchy.m
// OrgSync
//
// Created by Cameron Desautels on 11/12/13.
// Copyright (c) 2013 OrgSync. All rights reserved.
//
#import "UIView+Hierarchy.m"
@camdez
camdez / meeting-notes.md
Created September 9, 2013 22:32
Meeting notes using Mac OS's Dictation feature.

This dealer daycare at 404 Second is the gym doors I hate you you know what you know that threshold is that the slave behind replication at what point does the master . Holy does is it with the slate to lock the sleep yet masters trying to repeat fucking love this you have one master got hundreds place right place that is also doing his thing is that every of the laughter doesn't the masses and give the slave slave to fill those that are not a cigarette on your break Good morning to you all on overnight radar Everybody is fine. And if I have a disease fire around urban walking finished depending to you that you do as they read off the masculine binary right into really long locally so that they crashed it still replaced the relay and then in another thread on the slavery is often relate to this single friends to mirroring log on and that's how it can best how to tell if it's falling behind rice massive set of updates going on Master they have reliably chat and sleep until it slightly behind A semi love is lik

@camdez
camdez / gist:5636706
Last active December 17, 2015 16:09
OrgSync API: Accounts: List Custom Profile Fields
[
{
"name": "Gender",
"position": 1,
"id": 23569,
"type": "Selection",
"page": 1,
"instructions": "",
"choices": [
{
@camdez
camdez / large-orgs.rb
Last active December 16, 2015 12:39
A simple Ruby application demonstrating how to use the OrgSync API. Lists all organizations with more than 20 members (using this API call: https://api.orgsync.com/api/docs/v2/orgs/index). Please note that this simple script disables SSL certificate verification for convenience of example, but SSL verification should be used in a production sett…
require 'faraday'
require 'json'
API_KEY = "dd6b9d2beb614611c5eb9f56c34b743d1d86f385"
API_BASE_URL = "https://api.orgsync.com"
# Set up the HTTP client
conn = Faraday.new(:url => API_BASE_URL,
:ssl => {:verify => false}) do |faraday|
faraday.adapter Faraday.default_adapter