Skip to content

Instantly share code, notes, and snippets.

View zspencer's full-sized avatar

Zee zspencer

View GitHub Profile
(defn inc-all []
(let [x '(1,2,3)]
(println (map inc x))
(println x)))
(inc-all)
@zspencer
zspencer / partial.js
Last active August 29, 2015 14:13
So, you want to define partials in javascript, eh?
// Given a function and a set of arguments, returns a function that, when called,
// uses the originally given arguments as well as the new arguments. Heavily inspired by
// Clojure: https://clojuredocs.org/clojure.core/partial
//
// Example:
// > function logger() { console.log(arguments); }
// > var prefixedLogger = partial("hi", "there);
// > prefixedLogger("mom");
// { '0': 'hi', '1': 'there', '2': 'mom' }
function partial(fn, others) {
require 'rspec'
require 'securerandom'
describe("Roman numeral conversion") do
def expect_numeral_to_become_number(numeral,number)
expect(convert_numeral(numeral)).to(eql(number))
end
it "should return 1 for I" do
@zspencer
zspencer / pro-engineering-2015-01-22-notes.md
Created January 23, 2015 04:18
Notes/Kata from CodeUnion Pro-engineering session 2015-01-22

Agenda: 6:00 ~ 6:10 - Review of last session concepts (TDD, Refactoring, 4 Rules of Simple Design) 6:10 ~ 7:00 - Mob programming on the Roman Numerals Kata, swapping drivers every 15m 7:00 ~ 7:05 - Break! 7:05 ~7:55 - Mob-programming on Roman Numerals Kata, swapping drivers ever 15m 7:55 ~ 8:00 - Reflect! How is our mental model of programming sharper at the end of the session than at the beginning?

Notes!

[vagrant@localhost ~]$ docker run -v /project:/project -ti centos:centos7 bash -l
[root@8f52d208561c /]# cd /project
[root@8f52d208561c project]# ls
[root@8f52d208561c project]# exit
logout
[vagrant@localhost ~]$ sudo service docker restart
Redirecting to /bin/systemctl restart  docker.service
[vagrant@localhost ~]$ doc^C
[vagrant@localhost ~]$ docker run -v /project:/project -ti centos:centos7 bash -l
[alias]
# Prints merged branches without the current working branch and mainline branches
extraneous-branches = "!f() { git branch --merged | grep -v -e 'gh-pages' -e 'master' -e 'staging' -e 'production'; }; echo `f`"
# Deletes the extraneous branches with a soft -d
remove-extraneous-branches = "!f() { git extraneous-branches; }; git branch -d `f`"
reb = remove-extraneous-branches
@zspencer
zspencer / code.rb
Last active August 29, 2015 14:14
best times for hacking
OPTIMAL_SCHEDULE_MAPPING = {
:zspencer => [
"Friday 5-7PM PST",
"Wednesday 5-7PM PST",
"Wednesday 6-8PM PST",
"Saturday 10AM-11AM PST",
"Saturday 11AM-12PM PST",
"Sunday 10AM-11AM PST",
"Sunday 11AM-12PM PST"
],
$ curl -L -v www.apprenticeshipcommunity.com/
* Hostname was NOT found in DNS cache
* Trying 50.31.225.93...
* Connected to www.apprenticeshipcommunity.com (50.31.225.93) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: www.apprenticeshipcommunity.com
> Accept: */*
>
< HTTP/1.1 404 Not Found
---
layout: nil
---
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Musings and Mutterings of Zee Spencer</title>
<link rel="self" type="application/atom+xml" href="http://zeespencer.com/index.xml" />
<link href="http://zeespencer.com/" />
<updated>{{ site.time | date_to_xmlschema }}</updated>
describe "Converting Arabic Numerals to Roman Numerals" do
NUMERAL_TRANSLATIONS = {
1 => "I",
2 => "II",
5 => "V",
10 => "X"
}
NUMERAL_TRANSLATIONS.each_pair do |arabic, roman|
it "converts #{arabic} to #{roman}" do
expect(arabic_to_roman(arabic)).to eql(roman)