Skip to content

Instantly share code, notes, and snippets.

View Thomascountz's full-sized avatar
💃
LGTM!

Thomas Countz Thomascountz

💃
LGTM!
View GitHub Profile
class Dictionary
def self.search_danish(word)
new(:da).search(word)
end
def initialize(language)
@language = language
end
def search(word)
@Thomascountz
Thomascountz / insert_all_behavior.rb
Last active June 2, 2022 18:19
activerecord test script for PR#45036 experimentation
# frozen_string_literal: true
require "bundler/inline"
gemfile do
source "https://rubygems.org"
# gem "activerecord", github: "thomascountz/rails", ref: "5942211feba53c8deec8884bcee109a759c5e60d"
gem "activerecord", path: "/worspaces/rails"
gem "sqlite3"
@Thomascountz
Thomascountz / split_names_prototype.rb
Created May 8, 2022 17:25
Ruby executable file to test a split_names! prototype - RailsConf 2022
#! /usr/bin/env ruby
## Usage:
# $ chmod +x ./split_names_prototype.rb
# $ ./split_names_prototype.rb
## Run Specs
# Remove breakpoint: (`binding.pry`)
# $ rspec ./split_names_prototype.rb
@Thomascountz
Thomascountz / active_record_test_bed.rb
Created February 16, 2022 08:41
In-memory ActiveRecord Test Bed
# active_record_testbed.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'activerecord', require: 'active_record'
gem 'sqlite3', require: true
gem 'pry', require: true
end
@Thomascountz
Thomascountz / kaffe_log.py
Created January 22, 2022 12:59
A script to read values written to serial from a thermocouple attached to an Arduino to monitor coffee roasting
#!/usr/bin/env python3
import sys
import getopt
import serial
import time
import datetime
import csv
def main(argv):
@Thomascountz
Thomascountz / coloco
Created September 14, 2021 02:53
Columnar Datastore?
#!/usr/bin/env ruby
## USAGE EXAMPLE
## $ bin/coloco '{ "key": "value" }'
##
## $ find ./datastore -type f | xargs tail -n +1
## ==> ./datastore/key <==
## value
##
## ==> ./datastore/index <==
@Thomascountz
Thomascountz / daq_serial_sensor_samples.ipynb
Last active August 22, 2021 21:48
Hand gestures prediction based on z-axis accelerometer data from low-cost DAQ hardware
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Thomascountz
Thomascountz / copenhagenair.ipynb
Last active August 3, 2021 13:40
CopenhagenAir.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Thomascountz
Thomascountz / output.md
Last active September 8, 2020 11:31
Webpacker 5 Ignoring packs with the same name
$ rails -v

Rails 6.0.3.2
$ ruby -v

ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c)
@Thomascountz
Thomascountz / keyword_default_arguments_bench.rb
Created September 5, 2020 13:49
Benchmark using ARGS constant for default method arguments
require 'benchmark/ips'
Benchmark.ips do |benchmark|
benchmark.config(time: 5, warmup: 2)
benchmark.report("keyword-args") do
def foo(a: nil, b: nil, c: nil, d: nil, e: 1)
bar(a: a, b: b, c: c, d: d, e: e)
end