Skip to content

Instantly share code, notes, and snippets.

View jamesdabbs's full-sized avatar

James Dabbs jamesdabbs

View GitHub Profile
@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 / 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)
}
@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
<!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 / requests.json
Created November 13, 2015 19:10
Medlink endpoint examples
{ "requests": [
{ "created_at": "2015-09-13 14:00:26 -0400", "supplies": [
{ "name": "Bandages", "response_id": 123, "response_type": "Delivery", "responded_at": "2015-11-10 14:05:38 -0500" },
{ "name": "Tylenol", "response_id": 456, "response_type": "Denial", "responded_at": "2015-11-10 15:05:38 -0500" }
] },
{ "created_at": "2015-11-06 14:01:07 -0500", "supplies": [
{ "name": "Bandages", "response_id": 123, "response_type": "Pickup", "responded_at": "2015-11-10 14:05:38 -0500" },
{ "name": "Something Else", "response_id": null, "response_type": null, "responded_at": null }
] }
]}
@jamesdabbs
jamesdabbs / rcc-resources.md
Created May 15, 2015 13:26
Rails crash course - Resources
@jamesdabbs
jamesdabbs / mic_check.rb
Created March 28, 2015 19:31
Checks that your system is set up and ready to learn
#!/usr/bin/ruby
# ^- tells the shell to run this script using _system_ ruby
#
# To use, either copy this file or save its contents into a new file
# (named e.g. `mic_check.rb`), and then run
# $ chmod +x ./mic_check.rb
# $ ./mic_check.rb
#
# Checks your system to ensure that it's setup as expected:
# * has developer tools, brew, a recent git and an editor
#!/usr/bin/env ruby
def s n
Math.sqrt n
end
approxes = [
"3",
"s(7 + s(6 + s(5)))",
"(63 * (17 + 15 * s(5))) / (25 * (7 + 15 * s(5)))",
@jamesdabbs
jamesdabbs / heroku_scan.rb
Created March 3, 2015 18:23
Use the Heroku Platform API to find an app by config variable (namely `MANDRILL_USERNAME`)
require 'httparty'
require 'pry'
ADDRESS = "app15863835@heroku.com"
class Heroku
include HTTParty
base_uri "https://api.heroku.com"
def self.get_token