Skip to content

Instantly share code, notes, and snippets.

View jamesdabbs's full-sized avatar

James Dabbs jamesdabbs

View GitHub Profile
jamesdabbs /
Created July 2, 2019 15:22
Categories for the Working Programmer - a deckset presentation

[fit] Category Theory

[fit] For the Working Programmer

James Dabbs @jamesdabbs Santa Barbara JavaScript

inline fit

jamesdabbs / sendPasswordReset.ts
Created July 2, 2019 15:18
Refactoring a `sendPasswordReset` to be a (monadic) chain
import uuid from 'uuid/v4'
import {
Envelope, Token, User,
allUsers, deliverEmail, prompt, saveToken
} from '../util'
const promptFor = (message: string): string => {
return prompt()
jamesdabbs / ant.rb
Last active March 15, 2017 04:43
require 'progressbar'
class Ant
attr_reader :x, :y
def initialize
@x, @y = 0, 0
def move
jamesdabbs / 💩 🚌👏 .rb
Last active November 13, 2016 00:01
In response to @celeenr's ( RubyConf 2016 talk "Rhythmic Recursion"
class Voice
BASELINE = %w( there is no - poop ing - on - the bus - )
VOICES = `say -v '?'` { |line| line.split.first }
def initialize &voice
@voice, @i = voice, -1
def perform
jamesdabbs / index.html
Created September 30, 2016 15:33
JavaScript explorations
<!DOCTYPE html>
<script src="" integrity="sha256-5i/mQ300M779N2OVDrl16lbohwXNUdzL/R2aVUXyXWA=" crossorigin="anonymous"></script>
<script src="people.js"></script>
<button id="asdf">Click Me!</button>
jamesdabbs / simon.rb
Created July 29, 2016 12:52
Code from a Ruby crash course
require "pry"
puts "Hello!"
puts "What is your name?"
name = "James"
# name = gets
# puts "Hello, " + name
puts "Hello, #{name}"
jamesdabbs /
Created June 29, 2016 16:29
Gems to know about



helper for paginating lists (e.g. of search results) and displaying page lists (<< < ... 10 11 12 .. > >>)


run jobs outside the request-response loop, so that users don't have to wait e.g. for email to send before getting their response page. Also useful for running scheduled jobs (e.g. every 3 hours)

jamesdabbs /
Last active June 27, 2016 17:46
Iron Library | A project idea

Iron Library

Write an application that helps us manage the books in the Iron Yard lending library


  • Have user accounts, with different roles for students and staff
  • Staff can manage (general CRUD) books
  • Anyone can check out a book, and are given a due date for when to return it
  • When looking at a book, anyone can see who has it checked out currently (if anyone)

GET /bots

Show your bots (usually only one)

State could be running, stopped or crashed (in which case error will be present)

Element = :datum, :next do
def tail?
class SimpleLinkedList
attr_reader :size, :head
def self.from_a values