Skip to content

Instantly share code, notes, and snippets.

View lazyatom's full-sized avatar
🤠
Yes

James Adam lazyatom

🤠
Yes
View GitHub Profile
➜ rip (file_conflicts)⚡ $ rip use empty; rip env delete test; rip env create test; rip install monk
ripenv: using empty
ripenv: deleted test
ripenv: created test
Successfully installed thor (0.11.5)
Some files from wycats-thor (0.11.5) conflict with those already installed by thor:
lib/thor
lib/thor/actions
lib/thor/actions/create_file.rb
lib/thor/actions/directory.rb
@lazyatom
lazyatom / hooks.rb
Created August 17, 2009 08:45 — forked from defunkt/hooks.rb
module Rip
module Commands
# Runs ~/.rip/active/hooks/after-use after `rip use`
# and ~/.rip/active/hooks/on-leave when moving to another env
alias_method :rip_use, :use
def use(*args)
run_hook_if_exists('before-leave')
rip_use(*args)
run_hook_if_exists('after-use')
end
@lazyatom
lazyatom / hooks.rb
Created August 17, 2009 16:25 — forked from defunkt/hooks.rb
module Rip
module Commands
# Runs ~/.rip/active/hooks/used after `rip use`
# and ~/.rip/active/hooks/will-leave when moving to another env
alias_method :rip_use, :use
def use(*args)
run_hook_if_exists('will-leave', Rip::Env.active)
rip_use(*args)
run_hook_if_exists('used', Rip::Env.active)
end
module Rip
module Commands
x "Exports an environment into a self-contained compressed archive, using tar and gzip."
o "export [ENVIRONMENT]"
def export(options={}, env=Rip::Env.active)
`tar c --file=#{env}.tar -C #{File.join(Rip.dir, env)} . && gzip #{env}.tar`
end
x "Imports an exported environment."
o "Specify --as=ENVIRONMENT to change the environment name"
javascript:(function(){var%20local_hosts=['interblah','www.theauteurs'];var%20mapped_external_tlds=['net','com'];var%20hostname_parts=document.location.hostname.split(%22.%22);var%20tld=hostname_parts.pop();if(mapped_external_tlds.indexOf(tld)>=0){hostname_parts.push(%22local%22);}else{hostname_parts.push(mapped_external_tlds[local_hosts.indexOf(hostname_parts.join(%22.%22))]);};document.location.hostname=hostname_parts.join(%22.%22);})();
# how do you test algorithms?
class Pythagoream < Struct.new(:a, :b)
class BadArgument < ArgumentError; end
def result
raise BadArgument if a < 0 || b < 0
a**2 + b**2
end
end
# I'm creating some classes and modules on the fly, but things aren't hooking up quite the way I'd hoped.
# Can anyone explain why when an instance of Mod::Sibling tries to call Child.cry, that it
# doesn't call Mod::Child.cry, but instead looks for Behaviour::Child?
class Base
def self.cry
"#{self.name}.cry called!"
end
end
require 'wrest'
module FreeAgent
module Associations
HEADERS = {"Content-Type" => "application/xml", "Accept" => "application/xml"}
def self.included(base)
base.extend(ClassMethods)
end
#!/usr/bin/env ruby
require 'fileutils'
require 'singleton'
class Gitster
include Singleton
def initialize
@created_flags = []
require 'rubygems'
require 'free_agent'
# You'll need the 'free_agent' gem, which is on gemcutter, or available here:
# http://github.com/lazyatom/free_agent
# Next, you'll want the config:
#
# ---
# :domain: lazyatom # for example