Skip to content

Instantly share code, notes, and snippets.

View kyleburton's full-sized avatar

Kyle Burton kyleburton

View GitHub Profile
@kyleburton
kyleburton / ccard.feature
Created June 2, 2011 20:58
Cucumber for testing my Twilio "La Cosa Nostra" IVR
Feature: La Cosa Nostra IVR Workflow
In order to register a credit card I want to call the La Cosa Nostra IVR
and simulate a phone call.
Background: As part of each Scenario I want to set my defaults.
Given my telephone number is "(100) 000-0001"
And I am testing the "CCard" workflow.
And I call the IVR.
Scenario: I register my card in one step and sign up for all services.
@kyleburton
kyleburton / cuke-step-multi-line.rb
Created June 2, 2011 21:03
Cucumber Step For Multiline Strings
Then /^the IVR says "([^\"]*)"$/ do |phrase|
@ivr_client.last_response['twml'].should include(phrase)
end
Then /^the IVR says$/ do |multiline|
multiline.split(/\n/).each do |phrase|
phrase.strip!
@ivr_client.last_response['twml'].should include(phrase)
end
end
@kyleburton
kyleburton / wooo.d3.js
Created August 17, 2011 02:31
On any website, open the js-console and paste this... => wooo.stop() will halt the effect.
wooo = function () {
var self = {};
self.interval = 1000;
self.iLikeIt = true;
self.init = function () {
var script = document.createElement("script");
script.setAttribute("src", "http://mbostock.github.com/d3/d3.js?1.29.1")
document.getElementsByTagName("head")[0].appendChild(script);
@kyleburton
kyleburton / sample-Rakefile.rb
Created September 8, 2011 16:29
Rakefile for Chris B. B.
require 'rubygems'
require 'fileutils'
require 'net/http'
require 'net/https'
require 'json'
require 'pp'
def http_get url
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
@kyleburton
kyleburton / multi-dyn-dispatch.clj
Created November 16, 2011 03:29
clojure multi-method dyn dispatch example
(defmulti my-multi (fn [arg]
(if (.startsWith arg "a")
:a
:b)))
(defmethod my-multi :a [arg]
(format "this is :a gonka-donk: %s" arg))
(defmethod my-multi :b [arg]
(format "b is the b is the b damn it: %s" arg))
// http://www.hackerrank.com/
// open JS console in Chrome, paste into JS console
// run:
// Foo.playGames( 7, 99 )
// to play 99 games starting with the opening value of 7
Foo = (function () {
var self = {autoContinue: true};
self.startGame = function (numCandies) {
$.ajax({
@kyleburton
kyleburton / fizz-buzz.clj
Last active December 10, 2015 11:38
fizz-buzz.clj
;; condition free fizz-buzz solution, based on code from [email protected] to the clojure list
;; uses infinite, lazy-sequences
(let [three (cycle [nil nil "fizz"])
five (cycle [nil nil nil nil "buzz"])]
(defn fizz-buzz []
(map vector (iterate inc 1) three five)))
(doseq [tuple (take 30 (fizz-buzz))]
(println (apply str (interpose " " (filter identity tuple)))))
$meats = %w[fajita-veggie carnitas barbacoa chicken steak]
$rices = ['no-rice', 'white rice', 'brown rice']
$salsas = ['mild salsa', 'medium salsa', 'salsa roja']
$toppings = %w[sour-cream guacamole lettuce cheese]
def gen
ingredients = []
base = $meats[rand($meats.size)] + ' burrito with '
ingredients << $rices[rand($meats.size-1)]
if rand < 0.9
@kyleburton
kyleburton / bot-verbs.txt
Last active August 19, 2024 23:02
The list of 'bot-verbs' that we give to new team members.
Philosophical:
* writing lines of code is one of the least valuable things I can do
* cultivate your impatience
* reject the status quo, unless we can re-derive it from first-principles
* engineers imprint on the first languages (techniuqes, frameworks or technology) that we find success with (unconsciously seen as caregivers, which we defend w/o always knowing why)
* we tend to overvalue the familiar/known; we tend to undervalue the unfamiliar/unknown, this interferes with our receptiveness to new ideas and personal growth
* we're 90% composed of bad habits; many of our best habits become bad as time passes; this allows us to filter for the fundamental; the great
* make doing the right thing easier than any other thing, or we will fail to achieve greatness, or break bad habits
* be conscious, be intentional
* "is this the highest we can aim?" (I prefer this over "is this the best we can do", the former is aspirational, the latter is judgemental)
(let [chars (->
"01000010 01000101 01000101 01010010"
(.split " ")
vec)
nums (mapv #(Integer/parseInt % 2)
chars)]
(mapv #(-> % char str) nums))