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
#!/usr/bin/env ruby | |
#-*- coding: utf-8 -*- | |
def √(n) | |
Math::sqrt(n) | |
end | |
class Numeric | |
def ±(n) | |
r = [self + n, self - n] |
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
#-*- coding: utf-8 -*- | |
str = "<h1>Bugs#index</h1> | |
<%= @user %> | |
<p>á</p>" | |
str =~ /(?m-ix:<%(=+|-|\#|%)?(.*?)([-=])?%>([ \t]*\r?\n)?)/ |
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
#!/usr/bin/env ruby | |
project_source_dir = ARGV.first | |
project_source_dir += '/' unless project_source_dir[-1] == '/' | |
raise 'Not a Git repository' unless File.exists? "#{project_source_dir}.git" | |
# TODO: raise 'Not a Rails application' if ??? | |
def pending_git_tasks? |
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. | |
gem 'activerecord', '4.1.2.rc1' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
# This connection will do for database-independent bug reports. |
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' | |
# Activate the gem you are reporting the issue against. |
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 'minitest/autorun' | |
class TestSuite | |
def self.before_run | |
pid = fork do | |
puts "on fork" | |
exit 0 | |
end | |
Process.detach pid |
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 'rake' | |
class TasksTest < ActionDispatch::IntegrationTest | |
include ActionMailer::TestHelper | |
private | |
def self.task(t = nil) | |
return @task unless t | |
t = t.to_s |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Mobile Table + CSS Scroll Snap Points</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<style type="text/css" media="screen"> |
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
import java.lang.invoke.MethodHandles; | |
class Base { | |
public static class CurrentClassGetter extends SecurityManager { | |
public Class<?>[] getClassContext() { | |
return super.getClassContext(); | |
} | |
} | |
public static void find(int id) { |
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
# config/initializers/form_builder.rb | |
module InputTagsMarkedAsRequiredOrWithMinMaxLengthInHTMLIfValidatedForPresence | |
def initialize(object_name, method_name, template_object, options = {}) | |
return super unless options[:object] # it will be nil when called from #form_with | |
validators = options[:object].class.validators_on(method_name) | |
unless options.has_key? :required # check using has_key? to allow "required: nil" | |
if validators.any? ActiveRecord::Validations::PresenceValidator |
OlderNewer