Instantly share code, notes, and snippets.

View rspec_time_comparison_warning.rb
# This monkey patch modifies the RSpec `eq` matcher to suggest the `be_within`
# matcher instead when two time instances are being compared because equality
# comparison are inherently brittle on some operating systems like macOS so
# they may trigger false negatives.
module TimeComparisonWarning
def failure_message
msg = super
if [expected, actual].any? { |obj| obj.respond_to?(:strftime) }
View ember_cli_install_output
$ npm install -g ember-cli
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/Users/olivierlacan/.nvm/versions/node/v5.5.0/bin/ember -> /Users/olivierlacan/.nvm/versions/node/v5.5.0/lib/node_modules/ember-cli/bin/ember
/Users/olivierlacan/.nvm/versions/node/v5.5.0/lib
└─┬ ember-cli@2.7.0
├─┬ amd-name-resolver@0.0.5
│ └── ensure-posix-path@1.0.2
├── bower@1.7.9
├─┬ bower-config@1.4.0
│ ├── graceful-fs@4.1.5
View bottles.rb
class Bottles
def verse(number)
<<-STRING
#{pluralize_bottle(number, true)} of beer on the wall, #{pluralize_bottle(number)} of beer.
#{ending(number)}
STRING
end
def verses(first, second)
range = (second..first).to_a.reverse
View assets.rake
# These instance variables allow you to define which tags we should check
# to find references to JavaScript and CSS files.
#
# Included first are the Rails defaults `javascript_include_tag` and
# `stylesheet_link_tag`. Next are examples of custom methods we use at
# Code School with the content_for method in order to include JS/CSS in
# specific location such as the <head> tag in this instance.
JS_TAGS = %w[ javascript_include_tag included_javascript_for_head ]
CSS_TAGS = %w[ stylesheet_link_tag linked_stylesheet_for_head ]
View ruby_changelog_parser.rb
require "vandamme"
require "github/markup"
header = /(\w+ \w+ \d+) (\d+:\d+:\d+ \d+) (\w+ \w+ <.+>)/
changelog = File.read("ChangeLog.txt")
parser = Vandamme::Parser.new(changelog: changelog, version_header_exp: header, format: 'markdown')
File.open("ChangeLog.html", "w") do |f|
GitHub::Markup.render('README.markdown', "* One\n* Two")
f.write parser.to_html
View rspec_filter_ordering_spec.rb
require "spec_helper"
describe "Testing Filters" do
before(:all) { puts "In the beginning!" }
before(:each) { puts "1" }
around do |example|
puts "get around"
example.run
View p_value_from_z_score.md

Obtain P value from positive and negative Z scores

My fiancée is working on her master's thesis and her professor recommended a website that gives her P values when she plugs in Z scores.

The website works fine (although it crashes for a while on incorrect input) but it provides no transparency as to the formula used to compute the P value.

More problematic, she had to input hundreds of numbers into it which took forever. I tried to find an Excel formula that could replicate the results of the website

View 1_contributor_covenant_1_3_0.md

Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance,

View proposed_ruby_code_of_conduct.md

Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance,

View matz_edit_of_contributor_covenant_1-3-0.md

Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance,