Skip to content

Instantly share code, notes, and snippets.

View olivierlacan's full-sized avatar

Olivier Lacan olivierlacan

View GitHub Profile
### Version 16 20181010
### https://lafibre.info/remplacer-livebox/tuto-remplacer-la-livebox-par-un-routeur-dd-wrt-internet-tv/
### Informations utilisateur
user=fti/abcdefg
pass=hijklmn
maclivebox=01:23:45:67:89:AB
verlivebox=3
serlivebox=ABCDE0123456789
@olivierlacan
olivierlacan / rspec_time_comparison_warning.rb
Created September 24, 2018 16:53
Warn on RSpec comparisons between any time-like objects which may be sensitive to microsecond fluctuations in certain environments.
# 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) }
@olivierlacan
olivierlacan / ember_cli_install_output
Created August 13, 2016 18:37
After about 10 minutes (over a 1/3 Mbps connection) ember-cli finally finished installing, hard to believe the number of direct and transitive dependencies.
$ 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
@olivierlacan
olivierlacan / bottles.rb
Created July 22, 2016 07:40
My first ever 99 Bottles of OOP exercism torture run in 30 minutes and 34 seconds because I'm a dirty cheater. Just look at this ugly little thing. Go get Sandi and Katrina's book if you don't know what this is about: 99bottlesbook.com
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
@olivierlacan
olivierlacan / assets.rake
Last active February 16, 2023 10:37
Missing precompile asset finder for Rails 4.x and Sprockets 3.x
# 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 ]
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
@olivierlacan
olivierlacan / rspec_filter_ordering_spec.rb
Created April 11, 2016 15:40
Do you really know how RSpec filters work?
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
@olivierlacan
olivierlacan / p_value_from_z_score.md
Last active October 21, 2018 20:26
Determine P value from positive AND negative Z scores

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

@olivierlacan
olivierlacan / 1_contributor_covenant_1_3_0.md
Last active October 21, 2018 20:26
Comparing three proposals for a Ruby code of conduct from https://bugs.ruby-lang.org/issues/12004#note-276

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,

@olivierlacan
olivierlacan / proposed_ruby_code_of_conduct.md
Created January 23, 2016 00:01
Diff of Contributor Covenant 1.3.0 and Yukihiro "Matz" Matsumoto's proposed edited version from https://bugs.ruby-lang.org/issues/12004#note-95

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,