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/ruby | |
# Test different image libraries (ImageScience/FreeImage versus MiniMagick/GraphicsMagick) | |
# usage : imglib_test image_file height width x_offset y_offset cropped_height cropped_width | |
# outputs the results of the benchmark | |
usage = "usage : imglib_test image_file height width x_offset y_offset cropped_height cropped_width" | |
# Make sure we have enough arguments passed to us | |
exit puts(usage) || 1 unless ARGV.size == 7 |
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
$ imglib_test Chicago_HDR_5_by_CloudINC00.jpg 900 1500 60 500 400 700 | |
Rehearsal ------------------------------------------------- | |
Image Science 1.910000 0.070000 1.980000 ( 1.986456) | |
MiniMagick 0.010000 0.030000 2.390000 ( 1.787434) | |
---------------------------------------- total: 4.370000sec | |
user system total real | |
Image Science 1.880000 0.060000 1.940000 ( 1.936208) | |
MiniMagick 0.010000 0.030000 2.400000 ( 1.702564) |
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/ruby | |
# A really rough multiple-grouping hash datastore proof-of-concept | |
module DBastard | |
end | |
# internal format: @objects = { :some_identifier => "some blob", :other_identifier => "other blob" } | |
class DBastard::ObjectStore | |
# This is where everything gets stored | |
def objects |
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
#!/bin/bash | |
# Put this file somewhere in your path then do `chmod +x rails_helpers` on it | |
# Put `source rails_helpers` in your ~/.bash_profile or .bashrc | |
# Type `rails_helpers ?` to get a quick look at the aliases and functions defined within | |
if [ $# -gt 0 ]; then | |
echo 'rails_helpers: rails CLI helpers by Anthony M. Cook 2010-2011' | |
echo "cat $(which $0) for more info." | |
echo '' | |
echo 'aliases:' |
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
" search hilighting control, toggles, then enables intelligently | |
nnoremap / :set hlsearch<CR>/ | |
nnoremap ? :set hlsearch<CR>? | |
nnoremap n :set hlsearch<CR>n | |
nnoremap N :set hlsearch<CR>N | |
nnoremap <CR> :noh<CR><CR> | |
nnoremap <leader>/ :set hlsearch!<CR> | |
" all this works, except the n/N after hlsearch has been toggled |
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
# In some development environments, different developers have different needs | |
# and prefer to use different development gems. Now since Gemfiles are Just Ruby, | |
# it's pretty easy to work around the different environments. | |
#################################################################################### | |
# to use: | |
# 1) put the following code into your Gemfile | |
# 2) change the `optional_development_gems` array to your custom list | |
# 3) install none, any, or all of the gems in that list | |
# 4) export custom_gems=enabled | |
# 5) bundle install |
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
Precaching textmate bundles... | |
java -XstartOnFirstThread -d32 -client -Xbootclasspath/a:/Users/acook/.redcar/assets/jruby-complete-1.5.3.jar -Dfile.encoding=UTF8 -Xmx320m -Xss1024k -Djruby.memory.max=320m -Djruby.stack.max=1024k org.jruby.Main /Users/acook/.rvm/gems/ruby-1.9.2-p290/gems/redcar-0.11/bin/redcar --no-sub-jruby --ignore-stdin --no-gui --compute-textmate-cache-and-quit --multiple-instance --start-time=1314243239 | |
2011-08-24 20:37:40.774 java[64239:ba03] *** __NSAutoreleaseNoPool(): Object 0x11099b0 of class NSCFString autoreleased with no pool in place - just leaking | |
2011-08-24 20:37:40.776 java[64239:ba03] *** __NSAutoreleaseNoPool(): Object 0x1e801110 of class NSCFNumber autoreleased with no pool in place - just leaking | |
2011-08-24 20:37:40.776 java[64239:ba03] *** __NSAutoreleaseNoPool(): Object 0x110a290 of class NSCFString autoreleased with no pool in place - just leaking | |
2011-08-24 20:37:40.806 java[64239:ba03] *** __NSAutoreleaseNoPool(): Object 0x11114e0 of class NSPathStore2 autoreleased wi |
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
# | |
# = SuperStruct | |
# | |
# SuperStruct is an enhanced version of the Ruby Standard library <tt>Struct</tt>. | |
# | |
# Compared with the original version, it provides the following additional features: | |
# * ability to initialize an instance from Hash | |
# * ability to pass a block on creation | |
# | |
# You can read more at http://www.simonecarletti.com/blog/2010/01/ruby-superstruct/ |
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 'bundler' | |
Bundler.require(:test) | |
def run(*args) | |
output = Struct.new(:pid, :stdout, :stderr) | |
status = Open4.popen4(*args) do |pid, stdin, stdout, stderr| | |
output = output.new pid, stdout.read, stderr.read | |
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
# | |
# You can do `Object.send :include, Introspection` | |
# Then you can call `.introspect` on anything. | |
# | |
# The `introspect` method returns a hash with information about the receiver | |
# including its Class, the Constants and instance_methods defined inside it. | |
# | |
# The "depth" parameter indicates how deeply it should inspect the object. | |
# By default there is no depth limit. Pass in 1 to just get info on the object itself. | |
# |
OlderNewer