This file contains hidden or 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 ruby | |
# Binaries and Defaults | |
# ----------------------------------------------------------------------- | |
####################################################################### | |
# Do not change anything below | |
####################################################################### | |
require 'optparse' |
This file contains hidden or 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 | |
# ======================================================================= | |
# | |
# Unzips epub file, then checks version number | |
# | |
# To invoke, type: | |
# $ epubversion.sh filename.epub | |
# | |
# ======================================================================= |
This file contains hidden or 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 | |
# ======================================================================= | |
# | |
# Unzips epub file into a directory with the same basename. | |
# If the directory exists, abort. | |
# | |
# To invoke, type: | |
# $ epubopen.sh filename.epub | |
# |
This file contains hidden or 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 'io/console' | |
class Mysql < Thor | |
desc 'create DATABASE', 'create mysql database' | |
method_option :debug, :type => :boolean, :default => false, :aliases => "-d", :desc => "Debug" | |
method_option :verbose, :type => :boolean, :default => true, :aliases => "-v", :desc => "Verbose" | |
method_option :env, :type => :string, :default => 'development', :aliases => "-e", :desc => "Environment must be either 'development' or 'production'" | |
def create(db = nil) | |
debug = options[:debug] |
This file contains hidden or 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
class Config < Thor | |
PATH = 'config/config.yml' | |
desc 'get KEY', "get value of key in #{PATH}" | |
def get(key) | |
%w(development production).each do |env| | |
puts "#{env}:" | |
begin | |
value = get_config(key, env) | |
puts " #{key} => '#{get_config(key, env)}'" |
This file contains hidden or 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
/* Counter Script | |
* Requires Prototype Library | |
* By: <[email protected]> | |
* http://milkfarmproductions.com | |
* This work is licensed under the Creative Commons Attribution-Share Alike 3.0 | |
* http://creativecommons.org/licenses/by-sa/3.0/us/ | |
* | |
* Requirements: | |
* - A 'texter' input field, the field to be counted | |
* - A 'counter' input field with class equal to 'countClass' variable, the field to contain the count |
This file contains hidden or 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
# http://artofmission.com/articles/2009/5/31/parse-full-names-with-ruby | |
class Name < ActiveRecord::Base | |
def self.parse(name) | |
return false unless name.is_a?(String) | |
# First, split the name into an array | |
parts = name.split | |
This file contains hidden or 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
def debug(msg, object) | |
print "# [debug] #{msg} " | |
begin | |
Marshal::dump(object) | |
raise if object.nil? | |
puts h(object.to_yaml) | |
rescue Exception => e # errors from Marshal or YAML | |
# Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback | |
puts "--- #{object.inspect}" | |
end |