- My blink is that in 2012 Puppet is safer and more productive.
- Puppet is declarative, Chef procedural.
- Puppet brings system into compliance (state), Chef "does" things (recipes).
- Puppet has strong security practices; Chef has a toleration for loose security in Chef itself.
- Puppet makes it very hard to get "outside the lines" or violate its strong opinions; in Chef this is routine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Boustrophedon Transform in 1 line of haskell. Shove this in your GHCI, it will give you a function `pp` | |
-- which takes a function f :: Num a => (Integer -> a) and a depth v :: Num a => a, the former is the | |
-- sequence to transform, the latter is the depth of the tree to create. | |
-- I suggest running the results through mapM_ (putStrLn.show), it'll pretty print each level of the tree | |
-- in order. | |
let pp f v = let b s k n = if n==0 then s k else (b s k (n-1)) + (b s (k-1) (k-n)) in (\s k -> [[b s n' k' | k<-[1..n']]|n'<-[1..l]]) f v | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
### | |
# Test to demonstrate TCO in Ruby. Tested in 1.9.2+ | |
class TestTCO < MiniTest::Unit::TestCase | |
code = <<-eocode | |
class Facts | |
def fact_helper(n, res) | |
if n == 1 | |
res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here's how I might do it, though I'd probably skip the shared_examples and just duplicate them. I feel | |
# like it hides things a bit too much otherwise. Given that it doesn't represent a _huge_ extraction, I wouldn't | |
# mind the duplication. | |
# | |
# I'm pretty sure that subject is preserved across shared example calls, if it's not, you might need to improvise. | |
# | |
shared_examples_for "Firefox browser" do | |
its(:browser) { should == "Firefox" } | |
its(:security) { should == :strong } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 91c5562dc68d2b9f067b4bce76c14eff9e216cfc Mon Sep 17 00:00:00 2001 | |
From: Joe Fredette <jfredett@gmail.com> | |
Date: Fri, 15 Jun 2012 13:28:43 -0400 | |
Subject: [PATCH] add specs for Time#round | |
--- | |
spec/ruby/core/time/round_spec.rb | 54 ++++++++++++++++++++++++++++++++++++- | |
1 file changed, 53 insertions(+), 1 deletion(-) | |
diff --git a/spec/ruby/core/time/round_spec.rb b/spec/ruby/core/time/round_spec.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lass TransactionalHash < Hash | |
def transaction | |
old = dup | |
begin | |
return tap { yield(self) } | |
rescue Exception => e | |
clear | |
old.each do |k,v| | |
self[k] = v | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#0 0x00007fff918f2212 in __pthread_kill () | |
#1 0x00007fff93f33b34 in pthread_kill () | |
#2 0x00007fff93f77dfa in abort () | |
#3 0x00007fff93f78dd5 in __assert_rtn () | |
#4 0x0000000100248b07 in rubinius::MethodCacheEntry::create (state=0x101604d50, klass=0x108a4a0c0, mod=0x108a4a0c0, exec=0x1a, method_missing=rubinius::eNone, super=false) at cache.cpp:16 | |
#5 0x000000010005e1c1 in rubinius::InlineCache::fill_private (this=0x108c1c910, state=0x101604d50, name=0x2fce, start=0x108a4a0c0, klass=0x108a4a0c0, mce=@0x7fff5fbadcf8, super=false) at inline_cache.cpp:165 | |
#6 0x000000010005e9e3 in rubinius::InlineCache::empty_cache_private (state=0x101604d50, cache=0x108c1c910, call_frame=0x7fff5fbafde0, args=@0x7fff5fbaf290) at inline_cache.cpp:402 | |
#7 0x000000010005f42c in rubinius::InlineCache::initialize (this=0x108c1c910, state=0x101604d50, call_frame=0x7fff5fbafde0, args=@0x7fff5fbaf290) at inline_cache.hpp:201 | |
#8 0x000000010005bd35 in rubinius::InlineCache::check_cache (state=0x101604d50, cache=0x108c1c910, call_frame= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires rspec gem to be available, that's it. | |
require 'rspec' | |
class FailingClass | |
def self.create | |
new | |
end | |
end | |
FailingClass.private_class_method :new, :allocate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Version 2 -- the cool version | |
require 'redis' | |
require 'forwardable' #standard ruby library | |
class RedisTester | |
# this way, we create the instance and check to see it's running every time | |
# we ask for it automatically. | |
def redis | |
@redis ||= Redis.new | |
raise unless redis_is_running? | |
@redis |
OlderNewer