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
mysqldump -uroot --routines --no-data --quick --opt insight_card_services_development > ~/mysql.sql | |
cat ~/mysql.sql | mysql -uroot insight_card_services_test |
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
@agents = @bucket.find(:all, :joins => {:store => [:agent]}, :select => "agents.name as agent_name, COUNT(card_creation_transactions.id) as card_creation_transaction_count, card_creation_transactions.store_id, card_id", :group => "agents.name", :order => "agents.name") | |
@agents.map! {|cct| {"agent_name" => cct.attributes["agent_name"], "card_creation_transaction_count" => cct.attributes["card_creation_transaction_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
class Quiz | |
def initialize | |
@f = {} | |
@f['en.steps.foo'] = 'bar' | |
@f['en.steps.bar'] = 'wiggity' | |
@f['en.boogie.foo'] = 'liar' | |
@f['en.boogie.baz.noodles'] = 'potatosack' | |
@new_hash = {} | |
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 return_hash f | |
{ 'en' => { 'steps' => { 'foo' => 'bar', 'bar' => 'wiggity' }, 'boogie' => { 'foo' => 'liar', 'baz' => { 'noodles' => 'potatosack' } } } } | |
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
sc () { | |
[[ `rails -v` =~ ([0-9]) ]] | |
if [[ "$BASH_REMATCH" == "3" ]]; then rails c; else script/console; fi | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> | |
<title>Geolocation Test</title> | |
<script language="javascript" type="text/javascript"> | |
function getLocation() { | |
// Get location no more than 10 minutes old. 600000 ms = 10 minutes. |
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
Then /^the "([^"]*)" select field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value| | |
with_scope(selector) do | |
field = find_field(field) | |
values = field.native.children.map {|e| e.children[0].to_s} | |
assert(values.include?(value), true) | |
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
def self.fee_plans_for_agent(agent) | |
Region::FEE_PLANS.delete_if{|item| agent.code != "CS" && item[0] == "Checksmart Tax"} | |
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
class ActiveRecord::Relation | |
def explain | |
result = self.connection.execute("EXPLAIN #{self.to_sql}") | |
fields = result.fetch_fields | |
info = "" | |
fields.each do |field| | |
info << "| #{field.name} \t" | |
end | |
info << "|\n" | |
begin |
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 bang_x(x,ob) | |
bang_str = "" | |
x.times do | |
bang_str += "!" | |
end | |
eval("#{bang_str}ob") | |
end |