Skip to content

Instantly share code, notes, and snippets.

View jeroenvandijk's full-sized avatar

Jeroen van Dijk jeroenvandijk

View GitHub Profile

Docker Cheat Sheet

Why

Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment

(use '[datomic.api :only [q db] :as d])
(def uri "datomic:mem://accounts")
;; create database
(d/create-database uri)
;; connect to database
(def conn (d/connect uri))
@jeroenvandijk
jeroenvandijk / sat.clj
Last active August 29, 2015 14:14 — forked from jmgimeno/sat.clj
;Code from http://peteriserins.com/2011/12/23/sat-in-clojure-core-logic.html
;; lein try org.clojure/core.logic "0.8.8"
(require '[clojure.core.logic :refer [conde run* fresh ] :as l])
(declare goalify)
(defn and-rewrite [expr]
`(conde
#!/usr/bin/env ruby
#
# usage: script/server_restarter
#
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+
# is so fast when completely reloading the server, I wrote this script to listen to the
# given directories, and kill/restart the server when any file is changed.
#
# It's quick, simple, and it reliably reloads your application when changes are made.
#
#!/usr/bin/env ruby
#
# usage: script/server_restarter
#
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+
# is so fast when completely reloading the server, I wrote this script to listen to the
# given directories, and kill/restart the server when any file is changed.
#
# It's quick, simple, and it reliably reloads your application when changes are made.
#
class AddAttachmentsDataToWrapper < ActiveRecord::Migration
def self.up
add_column :wrappers, :data_file_name, :string
add_column :wrappers, :data_content_type, :string
add_column :wrappers, :data_file_size, :integer
add_column :wrappers, :data_updated_at, :datetime
end
def self.down
remove_column :wrappers, :data_file_name
#!/usr/bin/env ruby
module Chars
extend self
def scale(args, options={})
scale = options[:scale]
chars = args.map { |x| char(x.to_i).map { |row| row.split("") } }
print_chars scale_vertically(scale_horizontally(chars, scale), scale)
end
If you get this error:
~/current$ bundle install
Updating git://github.com/rails/rails.git
Fetching source index from http://gemcutter.org
Resolving dependencies
[..]
Installing actionmailer (3.0.0.beta) from git://github.com/rails/rails.git (at master) fatal: destination directory '/var/www/frontend/.bundle/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master' already exists.
fatal: Not a git repository
# Check this out, rvm use rbx
ruby_block "rvm use rbx" do
block do
Chef::Mixin::Command.popen4('bash -l -c "rvm use rbx && env"') do |p,i,o,e|
o.each_line do |line|
env_bits = line.split("=")
ENV[env_bits[0]] = env_bits[1]
end
end
# Check this out, rvm use rbx
ruby_block "rvm use rbx" do
block do
Chef::Mixin::Command.popen4('bash -l -c "rvm use 1.9.1 && env"') do |p,i,o,e|
o.each_line do |line|
env_bits = line.split("=")
ENV[env_bits[0]] = env_bits[1]
end
end