This file contains hidden or 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
# This can be added to config/initializers | |
class ActiveRecordPatch | |
# find_by(numeric_column: "foo") converts "foo" to 0 before searching. | |
# This is probably not desired. | |
# This patch prevents this behavior | |
# | |
def self.validate_input_for_numeric_conditions(class_or_query, conditions) |
This file contains hidden or 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
https://github.com/tmux-plugins/tmux-continuum | |
https://github.com/tmux-plugins/tmux-resurrect |
This file contains hidden or 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 'dotenv' | |
require 'pry' | |
require 'ruby-stackoverflow' | |
require 'rest_client' | |
Dotenv.load | |
RubyStackoverflow.configure do|config| | |
config.client_key = ENV["SO_PRIVATE"] |
This file contains hidden or 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 | |
ext = ARGV[0] | |
prefix = ARGV[1] | |
glob = Dir.glob "./*.#{ext}" | |
glob.each do |path| | |
`mv -- "#{path}" "#{prefix}#{File.basename path}"` | |
end |
This file contains hidden or 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
Stop a file from being tracked, but only for the local repo: | |
git update-index --assume-unchanged nbproject/project.properties | |
to revert that state: | |
git update-index --no-assume-unchanged | |
too see all files being ignored in this way: |
This file contains hidden or 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 'set' | |
class CoreUtil | |
def find_array_duplicates(array) | |
set = Set.new | |
array.select { |elem| !set.add?(elem) } | |
end | |
end |
This file contains hidden or 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
test |
This file contains hidden or 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
# It turns out this is pretty much unnecessary | |
# because "rspec --profile" does the same thing | |
# However I think this version's output is a | |
# bit prettier. | |
task :benchmark_test_suite => :environment do | |
require 'rspec_profiling' | |
require 'rspec_profiling/console' |
This file contains hidden or 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 AtomicityTestWithConcurrentThreadsAndGlobalVariables | |
# parameters | |
Global_in_count = 5000 | |
Thread_count = 500 | |
# global stores | |
Global_in = 1.upto(Global_in_count).to_a | |
Global_out = [] |
This file contains hidden or 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
# When including Sounds, some other modules/constants are loaded as well | |
module Sounds | |
def self.included(base) | |
super | |
base.class_exec do | |
# these are all defined elsewhere | |
include Sounds::Introduction | |
include Sounds::Base | |
include Sounds::Loader | |
include Sounds::Effects |