Skip to content

Instantly share code, notes, and snippets.

;;; All Kinds of Destructuring ;;;
(let [foo 1] foo)
; => 1
(let [[foo bar] [1 2 3]] [foo bar])
; => [1 2]
(let [[foo bar & baz] [1 2 3]] [foo bar baz])
; => [1 2 (3)]
@babysnakes
babysnakes / README.md
Created June 10, 2012 05:11
Modifying knife bootstrap (from chef) to exit with the exit code from the bootstrap command.

Modifying 'knife bootstrap' to exit with error upon failure.

Here is a description of the steps I took to cause knife bootstrap to exit with error when the remote bootstrap process fails. I was already calling the bootstrap programmatically (because I was adding a lot of business logic to it) so I didn't patch the bootstrap class but pulled out the pieces I needed.

The template.

#!/bin/bash
# Copied from Gary Bernhardt (destroyallsoftware.com) dot files repository.
#
# Log output:
#
# * 51c333e (12 days) <Gary Bernhardt> add vim-eunuch
#
# The time massaging regexes start with ^[^<]* because that ensures that they
# only operate before the first "<". That "<" will be the beginning of the
@babysnakes
babysnakes / index.html
Created April 2, 2012 04:42
Adding the bootstrap.css and bootstrap.js from twitter bootstrap 2.0.2 and latest jquery, I don't see tooltip on the "brand" class (although without css, I can see it).
<!DOCTYPE html>
<html>
<head>
<title>Testing ToolTips</title>
<link href="bootstrap.css" media="screen" rel="stylesheet" type="text/css" />
<script src="jquery.js" type="text/javascript"></script>
<script src="bootstrap.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#alink").tooltip({title: "See this"});
@babysnakes
babysnakes / deploy_via_methods.rb
Created January 4, 2012 05:44
Trying to create rolling deploy via capistrano.
role :servers, "server1", "server2"
set :user, 'ubuntu'
def stop_load_balancer
run "echo service registerelb stop"
end
def start_load_balancer
run "echo service registerelb start"
end