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 A | |
| def to_s | |
| "a" | |
| end | |
| end | |
| module B | |
| def to_s | |
| super + "b" | |
| 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
| # This small script uses the 'srt' gem to parse the srt file | |
| # It solves problems with certain subtitle files with empty lines that make Flex crash | |
| # You can use it with files, folders with files or even folders with subfolders with files (God bless Recursivity) | |
| # USAGE: ruby fix-srt.rb file/to/fix.srt | |
| # USAGE: ruby fix-srt.rb folder/with/files/to/fix | |
| # USAGE: ruby fix-srt.rb folders/with/subfolders/to/fix | |
| require 'rubygems' | |
| require 'srt' | |
| class StrFixer |
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
| curl ipecho.net/plain |
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
| for filename in *; do | |
| scp "$filename" user@host:/folder; | |
| done |
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
| testing |
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
| # This module allows you to run your request specs in a responsive mode quite easily | |
| # | |
| # Requirement: It requries Poltergeist, but could work with any capybara driver with a resize method | |
| # | |
| # Instructions: | |
| # | |
| # 0. Setup Poltergeist and register the driver | |
| # 1. Drop this module in your spec/support folder | |
| # 2. Include this module before your describe | |
| # 3. Use a responsive: true param in describe to enable responsive requests. We will need a js:true to enable poltergeist |
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
| ....... | |
| ....... | |
| <% cache menu_cache_key, expire_in: 1.day do %> | |
| <%= render(:partial => "/refinery/menu", :locals => { | |
| :css => 'submenu' | |
| }) %> | |
| <% 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
| $('form').parsley( { | |
| listeners: { | |
| onFieldError: function ( elem, constraints, ParsleyField ) { | |
| if (javascript_env == 'production') { | |
| return; | |
| } | |
| _log("Errores: ") | |
| _log(elem.attr("name") + ": " + elem.val()); | |
| for(constraint_id in constraints) { |
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
| # Extension to Refinery Admin controller to avoid 2 problems: | |
| # | |
| # 1) Edit locale propagates through requests as Thread.current[:globalize_locale] is never reset to nil | |
| # 2) Crudify's find filter is pepended before de globalize filter. This way, if you're editing in a non-default locale and the update url comes with a slug in that locale it won't be found (in fact, it does work in some circunstances) | |
| ::Refinery::AdminController.class_eval do | |
| # We should reset globalize so we don't propagate Globalize locale between requests | |
| def reset_globalize | |
| Thread.current[:globalize_locale] = nil |
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 'vcr' | |
| VCR.configure do |c| | |
| c.cassette_library_dir = 'spec/fixtures/vcr/' | |
| c.hook_into :webmock # or :fakeweb | |
| c.allow_http_connections_when_no_cassette = true | |
| c.configure_rspec_metadata! | |
| c.default_cassette_options = { :record => :new_episodes, :erb => true, :match_requests_on => [:path] } | |
| c.ignore_request do |request| | |
| uri = URI(request.uri) | |
| uri.host == '127.0.0.1' |