Skip to content

Instantly share code, notes, and snippets.


Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

View gist:1209000fe9f169c676c3
==> Summary
🍺 /usr/local/Cellar/erlang/17.1_1: 7377 files, 282M
==> Installing elixir
==> Downloading
Already downloaded: /Library/Caches/Homebrew/elixir-0.15.1.mavericks.bottle.tar.gz
==> Pouring elixir-0.15.1.mavericks.bottle.tar.gz
🍺 /usr/local/Cellar/elixir/0.15.1: 322 files, 4.2M
air:~ ricn$ iex
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
View mix.exs
defmodule Bitdoc.Mixfile do
use Mix.Project
def project do
[app: :bitdoc,
version: "0.0.1",
elixir: "~> 1.0",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
ricn / blah
Created May 11, 2015
Phoenix 0.13
View blah
Air:bitdoc ricn$ mix deps.get
Running dependency resolution
Dependency resolution completed successfully
All dependencies up to date
Air:bitdoc ricn$ mix phoenix.server
lib/phoenix_html.ex:1: warning: redefining module Phoenix.HTML
lib/phoenix_html/engine.ex:1: warning: redefining module Phoenix.HTML.Engine
lib/phoenix_html/form_data.ex:1: warning: redefining module Phoenix.HTML.FormData
lib/phoenix_html/form.ex:1: warning: redefining module Phoenix.HTML.Form
==> phoenix_html
View xml to couchdb
require "rubygems"
require "crack"
require "couchrest"
db = CouchRest.database!('')
jobs_as_xml = Net::HTTP.get_response(URI.parse('')).body
parsed_jobs = Crack::XML.parse(jobs_as_xml)
View Faker & couchdb
require "rubygems"
require "faker"
require "couchrest"
DB = CouchRest.database!('')
class Contact < CouchRest::ExtendedDocument
use_database DB
property :first_name
View My .gitignore
View gist:524736
> npm config get root
npm it worked if it ends with ok
npm cli [ 'config', 'get', 'root' ]
npm version 0.1.23
npm config file /Users/ricn/.npmrc
npm config file /usr/local/Cellar/node/0.1.104/etc/npmrc
npm ok
View bookmark.ex
defmodule Bookmarks.Bookmark do
use Bookmarks.Web, :model
schema "bookmarks" do
field :href, :string
field :title, :string
field :description, :string
View gist:9db349b19374b9b42b36
Test error:
3) test deletes chosen resource (Bookmarks.BookmarkControllerTest)
** (ArgumentError) argument error
:erlang.apply(695, :id, [])
Test code: