Skip to content

Instantly share code, notes, and snippets.

View eregon's full-sized avatar

Benoit Daloze eregon

View GitHub Profile
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 2, 2024 16:19
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@brainopia
brainopia / delayed_debug.rb
Created September 6, 2011 23:47
Non blocking delayed debugger for production
module Developer
extend self
delegate :establish_connection, :clear_all_connections!, :to => ActiveRecord::Base
def delayed_debug(scope)
detach_process do
close_io_objects
establish_connection
setup_process_name
notify_developers
@chenxiaolong
chenxiaolong / DellXPS15_9560_AHCI_RAID.md
Created November 27, 2017 01:33
Switching between AHCI and RAID on the Dell XPS 15 (9560)

Switching between AHCI and RAID on the Dell XPS 15 (9560)

This guide likely applies to other models and, potentially, even laptops from other OEMs that have NVME drives. However, I've only tested this on my Dell XPS 15 (9560) with the OEM Windows installation from the Signature Edition model.

Switching from RAID to AHCI

Switching from RAID to AHCI is significantly simpler than switching from AHCI to RAID. All that's needed is a successful boot to Safe Mode.

  1. To set the default boot mode to Safe Mode, use msconfig.exe or open an admin cmd/PowerShell window and run:
@eregon
eregon / 0_core_methods_in_ruby.md
Last active January 30, 2024 23:15
Core library methods defined with Ruby code and with a #source_location file starting with `<internal:`, by Ruby implementation and version
Ruby Core methods written in Ruby Total number of core methods % written in Ruby
CRuby 2.3 3 1637 0.2%
CRuby 2.4 3 1636 0.2%
CRuby 2.5 6 1680 0.4%
CRuby 2.6 5 1767 0.3%
CRuby 2.7 38 1802 2.1%
CRuby 3.0 89 1830 4.9%
CRuby 3.1 112 1884 5.9%
CRuby 3.2 128 1924 6.7%
@fnichol
fnichol / README.md
Created February 26, 2012 01:23
A Common .ruby-version File For Ruby Projects

A Common .ruby-version File For Ruby Projects

Background

I've been using this technique in most of my Ruby projects lately where Ruby versions are required:

  • Create .rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far...
  • Create .rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).

Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.

@igrigorik
igrigorik / webapp.rb
Created November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
@peey
peey / _config.yml
Last active October 19, 2023 12:14
Jekyll plugin for parsing of custom variables in permalinks
# will substitute :author with the variable author in your file (also works with defaults).
permalink: /:author/:slug/
# You need to have this extra permalink_custom_vars array to tell the plugin which substitutions to make
permalink_custom_vars: ['author']
# Note that you don't have to include the supported variables in this list as jekyll takes care of that
# For a complete list of variables jekyll supports, see: https://jekyllrb.com/docs/permalinks/#template-variables
@kddnewton
kddnewton / json.rb
Last active October 6, 2023 09:25
JSON parser with pattern matching
require "json"
struct = { "a" => 1, "b" => 2, "c" => [1, 2, 3], "d" => [{ "e" => 3 }, nil, false, true, [], {}] }
source = JSON.dump(struct)
tokens = []
index = 0
until source.empty?
tokens <<
@nateberkopec
nateberkopec / gist:11dbcf0ee7f2c08450ea
Last active March 24, 2023 21:59
RubySpec is dead, long live RubySpec!

Last night, Brian Shirai unilaterally "ended" the RubySpec project, a sub-project of Rubinius (the alternative Ruby implementation which Brian was paid to work on full-time from 2007 to 2013). The blog post describing his reasons for "ending" the project led to a big discussion on Hacker News.

When a single, competing Ruby implementation tells that you its test suite is the One True Way, you should be skeptical. Charles Nutter, Ruby core committer and JRuby head honcho, spent a lot of time last night on Twitter talking to people about what this decision means. He's probably too busy and certainly too nice of a guy to write about what is a political issue in the Ruby community, so I'm going to do it on behalf of all the new or intermediate Rubyists out there that are confused by Brian's decision and what it me

@smarr
smarr / truffle-material.md
Last active March 16, 2023 14:06
Truffle: Languages and Material