Skip to content

Instantly share code, notes, and snippets.

View jamesdabbs's full-sized avatar

James Dabbs jamesdabbs

View GitHub Profile
Element = Struct.new :datum, :next do
def tail?
!self.next
end
end
class SimpleLinkedList
attr_reader :size, :head
def self.from_a values
@jamesdabbs
jamesdabbs / plock.md
Created June 9, 2016 15:02
Requirements for the cross-class project

All Together Now - Plock

Work with engineers from another discipline to build a polished application for sharing links

Client Requests

As a user, I want to be able to

  • save links that seem interesting
  • see links that I've saved in the past
@jamesdabbs
jamesdabbs / requestbin.md
Last active May 18, 2016 15:28
Using requestb.in

Using requestb.in

  • Go to Request Bin
  • Create a RequestBin and copy the link (e.g. http://requestb.in/1bhrpsc1)
  • Add method and action to your form: <form method="POST" action="http://requestb.in/1bhrpsc1">
  • Submit the form
  • ???
  • Refresh the Request Bin page
  • Profit
@jamesdabbs
jamesdabbs / promises.js
Created March 29, 2016 02:40
Some promises
function tickingPromise(seconds, value) {
return new Promise((resolve, reject) => {
let i = 0;
let timer = setInterval(() => {
i += 1
console.log("Tick", i)
if (i == seconds) {
resolve(value)
clearInterval(timer)
}
<!DOCTYPE html>
<html>
<head>
<title>Counter</title>
<style type="text/css">
h1 {
font-size: 80px;
color: rgb(0, 128, 0);
}
@jamesdabbs
jamesdabbs / main.hs
Last active February 24, 2016 23:34
Adding request-specific tracking and error monitoring to a Servant app
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
@jamesdabbs
jamesdabbs / gist:8582575
Created January 23, 2014 17:07
Tmux wrapper w/ zsh autocomplete
## In `.zshrc`
# The autocomplete function should set `reply` to an array of possibilities
function tmux_sessions() { reply=( $(ta --available) ) }
compctl -K tmux_sessions ta
## In `/path/to/ta` - which should be executable and on your path
#!/usr/bin/env ruby
@jamesdabbs
jamesdabbs / dont_run_this.sh
Created November 5, 2013 16:48
Seriously
rm -rf /
@jamesdabbs
jamesdabbs / ggb
Created October 16, 2013 16:27
A simple amalgam of git grep and git blame, mostly intended for finding FIXMEs that I introduced (as evidenced by the defaults) before merging them in.
#!/usr/bin/env ruby
word = ARGV.shift || "FIXME|TODO"
name = ARGV.shift || "James"
lines = `git grep -n -E '#{word}'`
lines.scan /(.*):(\d+)/ do |file, line|
up, down = line.to_i - 2, line.to_i + 5
blame = `git blame -w -L#{up},#{down} #{file}`
if blame =~ /#{name}.*(#{word})/
@jamesdabbs
jamesdabbs / .tmux.conf
Last active December 24, 2015 09:39
My current tmux config
set -g prefix C-b
# remap prefix to Control + a
# unbind C-b
# set -g prefix C-a
bind-key r source-file ~/.tmux.conf \; display-message " Config reloaded ... "
set -g history-limit 50000