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
| tcp_syslog is now a gem : | |
| https://github.com/tech-angels/tcp_syslog |
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
| # 30 minutes Lisp in Ruby | |
| # Hong Minhee <http://dahlia.kr/> | |
| # | |
| # This Lisp implementation does not provide a s-expression reader. | |
| # Instead, it uses Ruby syntax like following code: | |
| # | |
| # [:def, :factorial, | |
| # [:lambda, [:n], | |
| # [:if, [:"=", :n, 1], | |
| # 1, |
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
| # Adapted for Rspec2. This won't work in RSpec 1. | |
| # Put this code in acceptance_helper.rb or better in a new file spec/acceptance/support/javascript.rb | |
| Rspec.configure do |config| | |
| config.before(:each) do | |
| Capybara.current_driver = :selenium if example.metadata[:js] | |
| end | |
| config.after(:each) do |
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
| defaults | |
| mode http | |
| clitimeout 600000 # maximum inactivity time on the client side | |
| srvtimeout 600000 # maximum inactivity time on the server side | |
| timeout connect 8000 # maximum time to wait for a connection attempt to a server to succeed | |
| balance roundrobin # each server is used in turns, according to assigned weight | |
| frontend http |
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
| # silly but useful. | |
| # -> compresses nested hashes into dot separated key value pairs | |
| class Hash | |
| def nested_flatten(prefix = 'h') | |
| arr = [] | |
| each do |key, value| | |
| k = prefix + ".#{key}" |
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
| # with multiple collections + commands for renaming back the collections | |
| require 'mongo' | |
| # Stop writing to your database. | |
| # Then, for each collection: | |
| # Specify the DB and COLLECTION you want to convert. | |
| # Will insert all modified documents into a new collection | |
| # called 'new_' + old_collection_name. | |
| # Then you can delete the old collection and rename the new one |
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 'action_controller/test_process' | |
| # Paperclip attachments in factories, made easy based on technicalpickles | |
| Factory.class_eval do | |
| def attach(name, path, content_type = nil) | |
| if content_type | |
| add_attribute name, ActionController::TestUploadedFile.new("#{RAILS_ROOT}/#{path}", content_type) | |
| else | |
| add_attribute name, ActionController::TestUploadedFile.new("#{RAILS_ROOT}/#{path}") | |
| 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
| // Released under MIT license: http://www.opensource.org/licenses/mit-license.php | |
| $('[placeholder]').focus(function() { | |
| var input = $(this); | |
| if (input.val() == input.attr('placeholder')) { | |
| input.val(''); | |
| input.removeClass('placeholder'); | |
| } | |
| }).blur(function() { | |
| var input = $(this); |