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 clone_table(src_db, dest_db, table, key_field = nil, filter = nil) | |
# filter the rows to be cloned | |
src_ds = src_db[table] | |
filter.each_pair{|k, v| src_ds = src_ds.filter(k => v)} unless filter.nil? | |
# truncate if no key_field | |
unless key_field | |
puts "truncating #{table}..." | |
dest_db[table].delete | |
end |
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 clone_table(src_db, dest_db, table) | |
# filter the rows to be exported | |
dataset = src_db[table] | |
# truncate if no key_field | |
unless key_field | |
puts "truncating #{table}..." | |
dest_db[table].delete | |
end |
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 'rubygems' | |
require 'sequel' | |
require 'faker' | |
require 'sequel_plus' | |
require 'progressbar' | |
require 'benchmark' | |
begin | |
DB = Sequel.connect("jdbc:mysql://localhost/jdbc_test?user=root") | |
rescue |
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 bash | |
# | |
# Automatically sets the wrappers for textmate's use | |
# Based on article posted: http://www.christopherirish.com/2010/06/28/how-to-setup-textmate-to-use-rvm/ | |
# Set up the TM_RUBY shell variable as described and remove the Builder as described and restart TextMate | |
# | |
# Make this script executable and you should be good to go! TextMate will stay in sync with rvm, which | |
# generally means the last project folder you switched into from terminal shell. | |
# | |
if [[ $TM_WRAPPING != "1" ]]; then |
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
prefix: 'textmate'. | |
wrapper: 'ruby'. | |
wrapper: 'gem'. | |
wrapper: 'irb'. | |
wrapper: 'ri'. | |
wrapper: 'rdoc'. | |
wrapper: 'rake'. | |
wrapper: 'erb'. | |
wrapper: 'testrb'. |
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 'csv' | |
raise "usage: ruby show.rb filename" unless ARGV[0] | |
fn = ARGV[0] | |
raise "specified file, #{fn.inspect} does not exist" unless File.exist? fn | |
flattened_tasks = CSV.read(fn) | |
headers = flattened_tasks.shift |
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 'pcap' | |
require 'getopts' | |
def pcaplet_usage() | |
$stderr.print <<END | |
Usage: #{File.basename $0} [ -dnv ] [ -i interface | -r file ] | |
#{' ' * File.basename($0).length} [ -c count ] [ -s snaplen ] [ filter ] | |
Options: | |
-n do not convert address to name | |
-d debug mode |
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
scope(:controller => 'site/about') do |about| | |
get 'about/community', :controller => 'site', :action => 'redirect', :path => '/community', as: :site_about_community | |
get 'about/offices', :controller => 'site', :action => 'redirect', :path => '/offices', as: :site_about_offices | |
get 'about/office/:id', :controller => 'site', :action => 'redirect', :path => '/offices', as: :site_about_office_detail | |
end | |
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
module ApplicationHelper | |
def back_url(parents) | |
url_for(parents).split("/")[0..-2].join("/") | |
end | |
end |
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 'minitest_helper' | |
ADDRESSES = { | |
toledo_ohio: { | |
street1: '', | |
city: 'Toledo', | |
state: '', | |
zip: '', | |
country: 'United States', | |
expected_obfuscated_street: '', |
OlderNewer