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% |
This file contains 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 "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 << |
This file contains 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 'tmpdir' | |
require 'rbconfig' | |
def inline_c_extension(c_code) | |
Dir.mktmpdir('inline_c_extension') do |dir| | |
File.write("#{dir}/cext.c", c_code) | |
File.write("#{dir}/extconf.rb", <<~RUBY) | |
require 'mkmf' | |
create_makefile('cext') | |
RUBY |
This file contains 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 | |
private def benchmark(name = nil, &block) | |
raise "needs a block" unless block | |
binding = block.binding | |
file, line = block.source_location | |
start_line = line - 1 | |
lines = File.readlines(file) | |
indent = lines.fetch(start_line)[/^(\s+)/, 1] |
This file contains 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
#include <sys/time.h> | |
#include <sys/types.h> | |
#include <sys/resource.h> | |
#include <sys/wait.h> | |
#include <spawn.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <unistd.h> |
This file contains 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
$ cat benchmark.yml | |
# Config for benchmark_driver.gem | |
type: command_stdout | |
name: optcarrot | |
command: bin/optcarrot --benchmark examples/Lan_Master.nes | |
metrics_type: | |
unit: fps | |
stdout_to_metrics: | | |
match = stdout.match(/^fps: (?<fps>\d+\.\d+)$/) | |
Float(match[:fps]) |
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 is significantly simpler than switching from AHCI to RAID. All that's needed is a successful boot to Safe Mode.
- To set the default boot mode to Safe Mode, use
msconfig.exe
or open an admin cmd/PowerShell window and run:
This file contains 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
# 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 |
This file contains 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
#include <stdio.h> | |
#include <unistd.h> | |
#include <signal.h> | |
#include <string.h> | |
#include <errno.h> | |
void on_signal(int sig) { | |
printf("\nIN handler\n"); | |
//nothing | |
} |
NewerOlder