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
# Mail Chimp Test Task | |
API_KEY = 'api-key' | |
LIST_NAME = 'list name' | |
require 'rubygems' | |
require 'xmlrpc/client' | |
require 'active_record' | |
# === Database Setup |
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
output_file = File.open 'gem_remote_output.txt', 'w' | |
File.open 'gem_remote_input.txt' do |input_file| | |
input_file.each_line do |line| | |
match = line.match /^([^_\-][\-\w\.]*) \(([\d\.]*).*\)$/ | |
output_file.puts "gem install #{match[1]} -v #{match[2]}" if match | |
end | |
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
output_file = File.open 'activemerchant_gateway_output.rb', 'w' | |
output_file.puts "PAYMENT_GATEWAYS = {" | |
File.open 'activemerchant_gateway_input.txt' do |input_file| | |
input_file.each_line do |line| | |
match = line.match /^.*?(\w*).rb:.*class (\w*)Gateway.*$/ | |
next unless match | |
output_file.puts " \"#{match[1]}\" => {" | |
output_file.puts " :name => \"#{match[2]}\"," | |
output_file.puts " :class => ActiveMerchant::Billing::#{match[2]}Gateway" | |
output_file.puts " }," |
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
letters = 'satire' | |
dictionary = {} | |
results = [] | |
File.open("/usr/share/dict/words", "r") do |infile| | |
while line = infile.gets | |
word = line.chomp.downcase | |
next if word.size != 7 | |
key = word.chars.sort.join |
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
/*! | |
* jQuery TwitCharCounter Plugin | |
* version: 1.0 (10-MAR-2011) | |
* created by: PavelTyk | |
* | |
* This is a simple char counter plugin (like the Twitter one). It has flexible | |
* settings and allows minimize configuration settings. | |
* | |
* Examples and documentation at: https://gist.github.com/863967 |
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
$('ul.tab-controls li').bind('click', function() { | |
$(this).addClass('active').siblings().removeClass('active') | |
.parents('#funbox').find('ul.tab').hide().eq($(this).index()).fadeIn(500); | |
return false; | |
}); | |
// HTML: | |
// <div id="funbox"> | |
// <ul class="tab-controls"> | |
// <li class="active"><a href="#">Featured</a></li> |
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 config/simple_navigation.rb | |
require 'simple_navigation/rails_controller_methods' | |
ActionController::Base.class_eval do | |
def self.disable_navigation_auto_highlighting(*args) | |
around_filter :temporary_disable_simple_navigation_auto_highlighting, *args | |
end | |
def temporary_disable_simple_navigation_auto_highlighting | |
auto_highlight = SimpleNavigation::Configuration.instance.auto_highlight |
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
def logger | |
@logger_for_attachment_fu_rake_task ||= Logger.new STDOUT | |
end | |
def raise_with_logger(msg) | |
logger.error msg | |
raise msg | |
end | |
def obtain_class |
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
/*! | |
* jQuery HideConfirmation Plugin | |
* version: 1.0 (27-JUL-2011) | |
* created by: PavelTyk https://github.com/PavelTyk | |
* | |
* This is a simple plugin to automatically hide confirmation fields if | |
* no changes made to observed field. | |
* | |
* Dual licensed under the MIT and GPL licenses: | |
* http://www.opensource.org/licenses/mit-license.php |
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 spec_helper: | |
# RSpec.configure do |config| | |
# ... | |
# config.include(MockGeocoder) | |
# end | |
# | |
# In your tests: | |
# it 'mock geocoding' do | |
# mock_geocoding! # You may pass additional params to override defaults (i.e. :coordinates => [10, 20]) | |
# address = Factory(:address) |
OlderNewer