Skip to content

Instantly share code, notes, and snippets.

View elskwid's full-sized avatar
🤡

Don Morrison elskwid

🤡
View GitHub Profile
@elskwid
elskwid / test_marshalling.rb
Created January 13, 2011 18:39
Test some aspects of marshalling using JRuby 1.6RC1
require 'test/unit'
require 'tempfile'
require 'ostruct'
class Test::Unit::TestCase
def marshalled(obj)
tmp = Tempfile.new('marshal')
tmp.puts Marshal.dump(obj)
tmp.close
# Version 0 (original)
def to
begin
name=self.first_name
unless name.nil?
name
name=name+" "+self.last_name
else
name=self.last_name
end
>> Using rack adapter
>> Exiting!
/home/web/website-rails/shared/bundle/ruby/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:304:in `depend_on': No such file to load -- Time (LoadError)
from /home/web/website-rails/shared/bundle/ruby/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:216:in `require_dependency'
from /home/web/website-rails/shared/bundle/ruby/1.8/gems/railties-3.0.3/lib/rails/engine.rb:138:in `eager_load!'
from /home/web/website-rails/shared/bundle/ruby/1.8/gems/railties-3.0.3/lib/rails/engine.rb:137:in `each'
from /home/web/website-rails/shared/bundle/ruby/1.8/gems/railties-3.0.3/lib/rails/engine.rb:137:in `eager_load!'
from /home/web/website-rails/shared/bundle/ruby/1.8/gems/railties-3.0.3/lib/rails/engine.rb:135:in `each'
from /home/web/website-rails/shared/bundle/ruby/1.8/gems/railties-3.0.3/lib/rails/engine.rb:135:in `eager_load!'
from /home/web/website-rails/shared/bundle/ruby/1.8/gems/railties-3.0.3/lib/rails/application.rb:108:in `eager_load!'
@elskwid
elskwid / tomcat_6_windows64_stack_trace.txt
Created March 4, 2011 01:48
Stack trace from Tomcat 6 on Windows Server 2008 64bit
Feb 24, 2011 10:50:42 PM org.apache.catalina.core.ApplicationContext log
SEVERE: unable to create shared application instance
org.jruby.rack.RackInitializationException: stack level too deep
from c:/home/openeln/console-server/webapps/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:348:in `catch'
from c:/home/openeln/console-server/webapps/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:348:in `resolve_requirement'
from c:/home/openeln/console-server/webapps/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:299:in `resolve'
from c:/home/openeln/console-server/webapps/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:298:in `reverse_each'
from c:/home/openeln/console-server/webapps/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:298:in `resolve'
from c:/home/openeln/console-server/webapps/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:349:in `resolve_requirement'
from c:/home/openeln/console-server/webapps/ROOT/WEB-INF/gems
Autotest.add_hook(:initialize) {|at|
# ...
# stop autotest from detecting changes in these files we don't care about
%w{.git .svn .hg .swp .DS_Store ._* tmp db log tmp vendor rerun.txt Gemfile.lock}.each do |exception|
at.add_exception(exception)
end
# ...
require 'autotest/growl'
require 'autotest/timestamp'
Autotest::Growl::clear_terminal = false
Autotest.add_hook(:initialize) {|at|
# at.clear_mappings # take out the default (test/test*rb)
# stop autotest from detecting changes in these files we don't care about
%w{.git .svn .hg .swp .DS_Store ._* tmp db log tmp vendor rerun.txt Gemfile.lock}.each do |exception|
@elskwid
elskwid / where-art-thou.rb
Created October 17, 2011 17:57
Where Art Thou for Hack4Reno
# gems and thangs
require 'rest_client'
require 'json'
# go easy on the fingers
data_url = "http://hack4reno.socrata.com/api/views/gbbk-wygz/rows.json"
rc = RestClient
# we'll take anything right now
result = ask "", :choices => "[ANY]"
@elskwid
elskwid / gist:1500078
Created December 20, 2011 03:18
git-deploy.rb
## Load this file in deploy.rb to use a GitHub style git-only deployment
## set useful variables
set(:latest_release) { fetch(:current_path) }
set(:release_path) { fetch(:current_path) }
set(:current_release) { fetch(:current_path) }
set(:current_revision) { capture("cd #{current_path}; git rev-parse --short HEAD").strip }
set(:latest_revision) { capture("cd #{current_path}; git rev-parse --short HEAD").strip }
set(:previous_revision) { capture("cd #{current_path}; git rev-parse --short HEAD@{1}").strip }
@elskwid
elskwid / ps_template_parser.rb
Created January 31, 2012 22:41 — forked from Alfaj0r/ps_template_parser.rb
Powerscribe templates XML parsing
#!/usr/bin/env ruby
require 'rexml/document'
include REXML
#open the XML file exported from Powerscribe
# Ruby lets us open the file in a block (thereby closing it when it's done)
File.open("Voice.xml") do |file|
# The "block" is that do ... end syntax and |file| is a reference to the file we've opened
doc = Document.new(file)
@elskwid
elskwid / verify_fingerprint.rb
Created March 7, 2012 18:42
Display the fingerprints for all your public keys
#! /usr/bin/ruby
home_dir = ENV["HOME"]
ssh_dir = "#{home_dir.strip}/.ssh/*.pub"
puts "Checking #{ssh_dir} ..."
puts
Dir["#{home_dir.strip}/.ssh/*.pub"].each do |pk|
puts "Fingerprint for #{pk}"
fingerprint = `ssh-keygen -lf #{pk}`