Skip to content

Instantly share code, notes, and snippets.

View technicalpickles's full-sized avatar

Josh Nichols technicalpickles

View GitHub Profile
@technicalpickles
technicalpickles / Gemfile
Last active June 3, 2025 15:38
tapioca bundler stuck on 0.16
# frozen_string_literal: true
source "https://rubygems.org"
# NOTE: `bundle add` ends up locking it to this version, even though it is `bundle add`'d without a version
gem "tapioca", "~> 0.16.11"

Given the user's input, identify which commands are being explicitly referred to. If there isn't no explicit reference, identify what the user is trying to do, and what commands are relevant to it.

RESPONSE FORMAT: You must respond in JSON format inside XML tags without additional commentary.

Example: { "commands": {

require 'benchmark/ips'
Dir.chdir ARGV[0] if ARGV[0]
glob ='{app,components,config,frontend,lib,packs,spec,danger,script}/**/*.{rb,arb,erb,rake,js,jsx,ts,tsx}'
Benchmark.ips do |x|
x.report "Dir.glob" do
Dir.glob(glob)
end
@technicalpickles
technicalpickles / main.go
Last active February 23, 2024 16:50
lefthook stdin capture reproduction WIP for https://github.com/evilmartians/lefthook/issues/588
package main
import (
"context"
"io"
"os"
"os/exec"
"github.com/creack/pty"
)
@technicalpickles
technicalpickles / benchmark.rb
Last active September 11, 2023 21:25
Bundler::Settings#[] benchmark, see https://github.com/rubygems/rubygems/pull/6923
require "benchmark/ips"
require "benchmark/memory"
require 'bundler'
class Bundler::Settings
def original(name)
key = key_for(name)
value = configs.values.map {|config| config[key] }.compact.first
converted_value(value, name)
@technicalpickles
technicalpickles / benchmark.rb
Created August 24, 2023 13:30
AbstractController::Base#action_methods benchmark
# frozen_string_literal: true
require 'action_controller'
require 'benchmark/ips'
require 'benchmark/memory'
puts "ActionPack.version = #{ActionPack.version}"
module Actions
def foo
end
@technicalpickles
technicalpickles / benchmark.rb
Last active August 15, 2023 17:13
Benchmarking Net::HTTPHeader#capitalize
# frozen_string_literal: true
require 'benchmark/ips'
require 'benchmark/memory'
def original(name)
name.to_s.split(/-/).map {|s| s.capitalize }.join('-')
end
def string(name)
name.to_s.split('-').map {|s| s.capitalize }.join('-')
@technicalpickles
technicalpickles / benchmark.rb
Created August 8, 2023 21:43
Ruby performance: caller vs caller(1, n) vs stack_frame gem
require 'benchmark/ips'
require 'stack_frames'
STACK_FRAMES_BUFFER = StackFrames::Buffer.new(500)
def recurse(n, &block)
if n > 0
recurse(n - 1, &block)
else
yield
# Using Sonic-Pi
samps = "/Users/technicalpickles/Dropbox/sonicpi-samples/"
##| use_bpm 120
define :mario_waha do |options={}|
options ||= {}
sample samps, "mlpit_mario_waha.wav", options
end
@technicalpickles
technicalpickles / whyunosleep.rb
Created November 7, 2017 20:56
Find out what is keeping your Mac display on
#!/usr/bin/env ruby
assertions = {}
lines = `pmset -g assertions`.lines.map {|line| line.chomp }
lines.each do |line|
# pid 329(Slack): [0x00004c1d00058b13] 24:48:54 NoDisplaySleepAssertion named: "Electron"
if line =~ /pid (\d+)\((.*)\): \[.*\] (\d+:\d+:\d+) (\w+) named: \"(.*)\"/
pid = $1.to_i
application = $2
date = $3
assertion_type = $4