Skip to content

Instantly share code, notes, and snippets.

View zerowidth's full-sized avatar

Nathan Witmer zerowidth

View GitHub Profile
@gvaughn
gvaughn / VimAndGitCodeDemos.md
Last active August 29, 2015 14:03
Vim and Git in Code Demos

Vim and Git in Code Demos

I want to give a code demo that shows progression of the code. I thought it would be great if I could craft the series of commits on a branch and have a single vim keystroke that would checkout the next (or previous) commit and force my buffers to reload. That would allow me to show one commit, then give me the freedom to live code how the next step is done, but when I advance to the next commit I know I'll have working code. It's like a safety harness for live coding.

Here's how it's supposed to work:

  • I created a test_forward branch, and, yeah, it's hardcoded in the vimscript :-(
  • Then I created 3 consecutive commits with one line changes in my README
  • optional: I used "git tag $tag_name" to give a friendly name in my bash prompt for each commit (I wish the fugitive statusline would use it too though)
  • I checked out the 1st of the demo commits
@FranklinChen
FranklinChen / spark.hs
Last active August 29, 2015 14:04
Spark line
-- Response to https://twitter.com/mfeathers/status/495979138365149184
-- Based on http://git.zx2c4.com/spark/tree/spark.c
import System.IO (hPutStrLn, stderr)
import System.Environment (getArgs)
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as C
main :: IO ()
main = do
@aphyr
aphyr / gist:aa3de337d12ac886eb96
Created October 9, 2014 23:59
Functional clojure.test
(require '[clojure.test :as test])
; Rewrite clojure.test to generate data structures instead of writing to
; stdout
(def ^:dynamic *results*
"Bound dynamically to an atom wrapping a vector of test report maps")
(defn add-name
"Given a testing report map, assoc's on a :name derived from the current
`clojure.test/testing` context."
@ianschenck
ianschenck / example.py
Last active August 29, 2015 14:21
interfaces
import interface
class IFoo(interface.Interface):
def foo(self):
"""foo this object."""
class IBar(interface.Interface):
module Test
module Unit
TestCase = RSpec::Core::ExampleGroup
end
end
class Test::Unit::TestCase
def self.inherited(host)
host.set_it_up host.name.gsub(/(Spec|Test)/,'')
def host.method_added(name)
@lynaghk
lynaghk / gist:1141054
Created August 11, 2011 23:21
Clojure sequentials & maps into JavaScript arrays and objects
(defn jsArr
"Recursively converts a sequential object into a JavaScript array"
[seq]
(.array (vec (map #(if (sequential? %) (jsArr %) %)
seq))))
(defn jsObj
"Convert a clojure map into a JavaScript object"
[obj]
(.strobj (into {} (map (fn [[k v]]
@geeksam
geeksam / gist:3735442
Created September 17, 2012 03:46
Canned reply to recruiting inquiries

Hi, [insert recruiter's first name here]-

I've gone to some lengths to save everyone some time by maintaining a FAQ page on my resume website: http://resume.livingston-gray.com/faq.html

I've even gone so far as to change my LinkedIn profile so that it directs recruiters to read the FAQs before contacting me about relocation opportunities. So, thank you, [recruiter's first name]! By carefully ignoring all of that information, you've freed me from having to feel even remotely guilty for sending you a canned response.

@ixti
ixti / app.css.sass
Created January 7, 2013 18:10
Example of using jekyll-assets + compass + susy
@import "susy"
.page { @include container; }
aphyr@waterhouse:~/timelike master$ lein test timelike.node-test
lein test timelike.node-test
Even connections LB
Total reqs: 10000
Latency distribution:
Min: 0.017489419380090965
Median: 141.4027252436847
95th %: 612.7774737814785
99th %: 937.1806417316121
@aphyr
aphyr / gist:5198654
Created March 19, 2013 18:17
Thoughts on configuration file complexity.

Some people think that configuration should not be "Turing complete"; others think the configuration language should be as expressive as possible--so much so that it amounts to a programming language itself.

I assert that configuration files which are not Turing complete (or, perhaps a more useful distinction, are not "sufficiently complex languages") are in practice extended to be that complex; and when that happens, the result is often more difficult to understand than if the language were more powerful to start with.