Skip to content

Instantly share code, notes, and snippets.

View lastobelus's full-sized avatar

Michael Johnston lastobelus

View GitHub Profile
sed -i -e'{/pattern/d}'
describe SageUsers, "(xml)" do
it "should not provide reset_password for xml" do
lambda { request('/reset_password/xxxyyy', :format => 'xml', :method => 'GET')}.
should raise_error(Merb::ControllerExceptions::NotAcceptable)
end
end
identify(PortalApp => :name, Theme => :name) do
themify = proc do |request, params|
portal_app = PortalApp.portal_app_from_params(params)
unless portal_app.nil?
theme = portal_app.theme_from_params(params)
controller = SageUsers.signup_controller_for_portal_app_and_theme(portal_app, theme)
params.merge!(:controller => controller)
end
params
end
self._template_roots = self._template_roots.
push([self._template_root / "theme", :template_location_with_portal_app_and_theme])
class << self
def signup_controller_for_portal_app_and_theme(portal_app, theme)
return self.controller_name if self.subclasses_list.empty?
unless theme.nil?
controller_name = "#{portal_app.name}_#{theme.name}_signup"
#!/usr/bin/env ruby
require 'rubygems'
require 'highline'
require 'yaml'
ENV['HOME']
user_name = ARGV[1] || 'root'
key_name = ARGV[2]
ruby "create the vagrant chef webui user" do
code <<-EOH
require 'rubygems'
require 'chef/webui_user'
Chef::Config[:node_name] = Chef::Config[:web_ui_client_name]
Chef::Config[:client_key] = Chef::Config[:web_ui_key]
exit(0) if Chef::WebUIUser.list.keys.include?("#{node[:vagrant][:webui_user][:username]}")
v = Chef::WebUIUser.new
v.name = "#{node[:vagrant][:webui_user][:username]}"
v.set_password "#{node[:vagrant][:webui_user][:password]}"
@lastobelus
lastobelus / editgem.rb
Created April 13, 2011 23:18
rvm compatible editgem in textmate command
#!/usr/bin/env ruby
editor = ENV['EDITOR'] || 'mate'
begin
require 'highline/import'
rescue Exception
puts "\e[33minstalling highline...(#{Process.pid})\e[0m"
require 'rubygems/command.rb'
require 'rubygems/dependency_installer.rb'
lasto:~/clients/partnerpedia/partnerpedia/vendor/mobihand_adapter(cisco/mobihand_adapter)$ pickler search
13175469 :D % We need to set up an app in vendor
13174209 :) 4 MobiHand Adapter authenticates with Marketplace API
13174383 :) 2 Catalog Adapter authenticates with the MobiHand API
13174439 :) 2 Catalog adapter notifies operations user of errors
13280233 :) 2 Catalog gets feed of products to import
13318681 :/ % Test double for Mobihand
13280683 :/ 4 Catalog adapter queues products from feed
13174537 :| 4 Product Importer creates company for the product
13254403 :| 0 Change external_edit_url to not required
@lastobelus
lastobelus / gem_from_git.rb
Created January 22, 2012 14:10
install a gem from github
#!/usr/bin/env ruby -KU
require "rubygems"
require "thor"
require "tmpdir"
class GemFromGit < Thor
include Thor::Actions
desc "install GIT-USER/REPO", "install a gem from github source."
@lastobelus
lastobelus / gist:1686936
Created January 27, 2012 04:09
Anki Crash Report
Process: Anki [546]
Path: /Applications/Anki.app/Contents/MacOS/Anki
Identifier: net.ichi2.anki
Version: 1.2.8 (1.2.8)
Code Type: X86-64 (Native)
Parent Process: launchd [206]
Date/Time: 2012-01-26 20:08:00.475 -0800
OS Version: Mac OS X 10.6.8 (10K549)
Report Version: 6