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 patch was found on http://deadmemes.net/2011/10/28/rvm-install-fails-on-ubuntu-11-10/ when looking for a problem installing ruby 1.9.2 on Ubuntu 11.10 | |
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').validate({ | |
| errorPlacement: function(error, element) { | |
| if (element[0].tagName == "SELECT") { | |
| element.parent().addClass('error'); | |
| } | |
| return true; | |
| }, | |
| unhighlight: function(element, errorClass, validClass) { |
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
| There's an issue on globalize when adding or removing fields from the translations that causes the original migrations don't work properly (https://github.com/svenfuchs/globalize3/issues/131). | |
| In my example I have a post model whih I create with some translated fields: name, slug and body. Some days later, I realise I need an excerpt field with a summarized version of the post and it has to be translated, so I create a migration to add this field. | |
| Unfortunately, when you create the translation table it takes not only the fields you set in the params (:name => :string, :slug => :string, :body => :text) but also the params specified to the translates method in the model (:excerpt included) and creates a column for each one of those. | |
| Solution here is to overwrite the translated attribute names of the class in the migration, so when you execute a migration you know which translated attributes will be declared and not need to worry about attributes that are not declared when you create the migration. | |
| Overwriti |
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
| if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
| begin | |
| rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
| puts rvm_path | |
| rvm_lib_path = File.join(rvm_path, 'lib') | |
| puts rvm_lib_path | |
| # $LOAD_PATH << rvm_lib_path | |
| require 'rvm' | |
| RVM.use_from_path! File.dirname(File.dirname(__FILE__)) | |
| rescue LoadError |
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
| Refinery::Page.class_eval do | |
| # When this page is rendered in the navigation, where should it link? | |
| # If a custom "link_url" is set, it uses that otherwise it defaults to the nested path. | |
| # This method is decorated so the ?locale=es doesn't appear at the end of the urls | |
| def url | |
| if link_url.present? | |
| link_url_localised? | |
| else | |
| nested_path |
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
| \documentclass[12pt]{article} | |
| \usepackage[utf8]{inputenc} | |
| \usepackage[spanish,activeacute]{babel} | |
| \title{Titulo} | |
| \author{Autor} | |
| \begin{document} |
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 patch fixes vulnerability CVE-2013-0156 in ActionPack[1] and it's intended for those apps that can't be updated and must find a quick solution. | |
| Just add the files to your project, require lib/patch/hash_conversions.rb, and that's all. | |
| This code patches ActiveSupport::CoreExtensions::Hash::Conversions methods so it takes into account the disallowed types and is based on 2.3 patch[2] | |
| [1] https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion | |
| [2] https://rubyonrails-security.googlegroups.com/attach/c1432d0f8c70e89d/2-3-xml_parsing.patch?gda=ulUUK0YAAABpGVv8GMoSBgW4J3Kez9oiOxgqxuyBYM9wRi8LhPWtIxxSeo4ig8fNU0gXvTeISk5x40jamwa1UURqDcgHarKEE-Ea7GxYMt0t6nY0uV5FIQ&pli=1&view=1&part=3 |
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
| # We have to remove validations on email, as it's no longer needed. | |
| # Based on a solution found at http://stackoverflow.com/questions/7545938/how-to-remove-validation-using-instance-eval-clause-in-rails | |
| Model.class_eval do | |
| _validators.reject!{ |key, _| key == :field } | |
| _validate_callbacks.each do |callback| | |
| callback.raw_filter.attributes.delete :field | |
| 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
| # Based on http://thedatachef.blogspot.com/2011/01/processing-xml-records-with-hadoop-and.html although I only can find it through Google Cache: | |
| # http://webcache.googleusercontent.com/search?q=cache:VuIRvlkYpjcJ:thedatachef.blogspot.com/2011/01/processing-xml-records-with-hadoop-and.html+&cd=1&hl=es&ct=clnk&gl=es | |
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'wukong' | |
| require 'wukong/encoding' | |
| require 'crack' | |
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
| location ~* ^/.+\.(jpe?g|gif|png|ico|zip|tgz|rar|bz2|doc|xls|exe|pdf|ppt|html?|tar|mid|midi|wav|bmp|rtf|swf|avi|mp3)$ { | |
| expires 30d; | |
| rewrite ^ http://www.example.com/$request_uri? permanent; | |
| break; | |
| } |