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
| window._collect_css = (function(){ | |
| var ALPHABET_SIZE=36, classnames={}, | |
| data = { | |
| total_elements: null, | |
| total_classes: null, | |
| avg_length: null, | |
| compressed_length: null, | |
| total_class_length: 0, | |
| total_class_count: 0, | |
| total_size: 0, |
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 'benchmark' | |
| _methods = ("a".."z").to_a | |
| module A | |
| module B | |
| module C | |
| module D | |
| module E | |
| class X |
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
| # Activate the gem you are reporting the issue against. | |
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'activerecord', '4.2.0' | |
| gem 'pg', '0.18' | |
| gem 'pry-byebug' | |
| GEMFILE | |
| system 'bundle' |
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
| # Suppose we updated our hash_data for Paperclip | |
| OLD_HASH = ":class/:attachment/:id/:style" | |
| NEW_HASH = ":class/:attachment/:id/:style/:updated_at" | |
| ACL = :public_read | |
| def restore(r) | |
| return unless r.file.exists? | |
| new_key = r.file.path[1..-1] | |
| r.file.options[:hash_data] = OLD_HASH; |
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
| .pi@session_cont | |
| .pi-select.pi data-on-changed="@host.date.text(@this.selected_record().dates)" | |
| ... | |
| ul.list | |
| li.item data-id="#{@id}" data-dates="#{@period}" | |
| ... | |
| .pi.date@date |
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
| = nested_form_for answer, remote: true, ... do |f| | |
| ... | |
| = f.fields_for :attachments do |attachment_form| | |
| - if attachment_form.object.file.present? | |
| p = attachment_form.object.file.identifier | |
| - else | |
| = attachment_form.label :file | |
| = attachment_form.file_field :file | |
| = attachment_form.link_to_remove "Remove this file" | |
| = f.link_to_add "Add file", :attachments |
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
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rubocop', github: 'bbatsov/rubocop' | |
| GEMFILE | |
| system 'bundle' | |
| end | |
| require 'bundler' |
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
| # Auhtorize any record to any policy | |
| def authorize_with(klass, record, query = nil) | |
| query ||= "#{action_name}?".to_sym | |
| @_pundit_policy_authorized = @_policy_authorized = true # two vars for forward compatibility | |
| policy = klass.new(pundit_user, record) | |
| unless policy.public_send(query) | |
| error = Pundit::NotAuthorizedError.new("not allowed to #{query} this #{record}") | |
| error.query = query | |
| error.record = record | |
| error.policy = policy |
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
| begin | |
| require 'bundler/inline' | |
| rescue LoadError => e | |
| $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
| raise e | |
| end | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'arel', github: 'rails/arel' |
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
| begin | |
| require 'bundler/inline' | |
| rescue LoadError => e | |
| $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
| raise e | |
| end | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'arel', github: 'rails/arel' |
OlderNewer