Skip to content

Instantly share code, notes, and snippets.

fn review(opts: &[&str]) {
let target = match opts {
[ "--for", p ] => p,
_ => "master"
};
let cwd = os::getcwd();
let have_dot_git = have_dot_git(cwd.clone());
let dot_git_dir: &Path = match have_dot_git.as_ref() {
Some(path) => path,
fn main() {
let args: Vec<String> = os::args();
let mut washed_args = Vec::new();
for arg in args.iter() {
washed_args.push(arg.as_slice())
}
match washed_args.as_slice() {
[_, “review”, opts..] => { review(opts) }
_ => { usage() }
@adamhjk
adamhjk / mono_v_mono.md
Created July 28, 2014 21:23
mono_v_mono

monlith

cookbooks/apache2: 1.2.1, depends: { app 0.7.0 }
cookbooks/app: 0.8.0
cookbooks/french_fries: 1.1.1

^ The above is not an acceptable thing

cookbook-as-repo

context 'when using sudo' do
let(:accessor) { :sudo }
it 'sets itself to true' do
let(:value) { true }
should eql(value)
end
end
@adamhjk
adamhjk / README.md
Last active July 25, 2021 05:44
Prove that Chef Solo works just fine with default attributes. Output of chef-solo -c solo.rb -j test.json:

Proves that default attributes work fine in Chef Solo:

chef-solo -c solo.rb -j test.json

  /t/w/solo-def ❯❯❯ chef-solo -c solo.rb -j test.json
  Starting Chef Client, version 11.4.4
  Compiling Cookbooks...
  [2013-08-02T10:30:01-07:00] WARN: I see that solo works... fine
 Converging 1 resources
@adamhjk
adamhjk / spec_helper.rb
Created May 23, 2013 13:50
Use LWRP finders in your ChefSpec
require 'chefspec'
require 'berkshelf'
require 'tmpdir'
require 'fileutils'
TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), ".."))
$: << File.expand_path(File.dirname(__FILE__))
Berkshelf.ui.mute!
berks = Berkshelf::Berksfile.from_file(File.join(TOPDIR, "Berksfile"))
@adamhjk
adamhjk / Guardfile
Last active December 17, 2015 03:19
A Guardfile with inline support for test-kitchen, before we turn it into a gem.
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require 'guard/guard'
require 'mixlib/shellout'
module ::Guard
class Kitchen < ::Guard::Guard
def start
::Guard::UI.info("Guard::Kitchen is starting")
@adamhjk
adamhjk / gist:5534477
Created May 7, 2013 17:33
Berkshelf and ChefSpec, sitting in a tree.
require 'chefspec'
require 'berkshelf'
require 'tmpdir'
require 'fileutils'
TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), ".."))
$: << File.expand_path(File.dirname(__FILE__))
berks = Berkshelf::Berksfile.from_file(File.join(TOPDIR, "Berksfile"))
tmpdirname = Dir.mktmpdir("chefspec-berks")
@adamhjk
adamhjk / .slate
Created April 24, 2013 16:45
My slate config!
config defaultToCurrentScreen true
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
# Monitor Aliases
alias mon-laptop 0
alias mon-dell 1
# Command e shows window hints
@adamhjk
adamhjk / gist:4693402
Created February 1, 2013 19:17
nginx modules
--with-http_ssl_module enable ngx_http_ssl_module
--with-http_realip_module enable ngx_http_realip_module
--with-http_addition_module enable ngx_http_addition_module
--with-http_xslt_module enable ngx_http_xslt_module
--with-http_image_filter_module enable ngx_http_image_filter_module
--with-http_geoip_module enable ngx_http_geoip_module
--with-http_sub_module enable ngx_http_sub_module
--with-http_dav_module enable ngx_http_dav_module
--with-http_flv_module enable ngx_http_flv_module
--with-http_mp4_module enable ngx_http_mp4_module