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
~ ruby json_benchmark.rb | |
String to JSON | |
Warming up -------------------------------------- | |
Oj.dump 24.918k i/100ms | |
Yajl.dump 9.461k i/100ms | |
JSON.dump 24.797k i/100ms | |
MessagePack.dump 44.355k i/100ms | |
Calculating ------------------------------------- | |
Oj.dump 267.683k (± 3.4%) i/s - 1.346M in 5.032971s | |
Yajl.dump 98.929k (± 2.8%) i/s - 501.433k in 5.072850s |
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 | |
require 'fiddle/import' | |
module GVLUnlock | |
extend ::Fiddle::Importer | |
dlload ::Fiddle::Handle::DEFAULT | |
FP = | |
bind 'void *cb(void *data)' do |ptr| | |
ptr.to_i << 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
require 'fiddle' | |
class GVL | |
handle = Fiddle::Handle::DEFAULT | |
address = handle['rb_thread_call_without_gvl'] | |
func = Fiddle::Function.new address, [Fiddle::TYPE_VOIDP, | |
Fiddle::TYPE_VOIDP, | |
Fiddle::TYPE_VOIDP, | |
Fiddle::TYPE_VOIDP], Fiddle::TYPE_VOIDP |
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
class Hangman | |
DICTIONARY = ["cat", "dog", "bootcamp", "pizza"] | |
def initialize() | |
@secret_word = Hangman.random_word | |
@guess_word = Array.new(@guess_word.length, "-") | |
@attempted_chars = Array.new | |
@remaining_incorrect_guesses = 5 | |
end |
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
module ApplicationHelper | |
def bell_notification_with_conditional_counter | |
keyword_arguments = {class: 'notification-bell'} | |
keyword_arguments[:data] = {count: '...'} if Notification.unread_count(current_user).nonzero? | |
icon("fas", "bell", **keyword_arguments) | |
end | |
end |
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 | |
# frozen_string_literal: true | |
require 'optparse' | |
require 'fileutils' | |
require 'open3' | |
module TerraformExecutor | |
Config = Struct.new(:parallelism, :init, :vault, :tag, keyword_init: true) |
OlderNewer