Skip to content

Instantly share code, notes, and snippets.

View mkreyman's full-sized avatar
🏃‍♂️
Building cool stuff, serving customers, and enjoying every moment of it...

Mark Kreyman mkreyman

🏃‍♂️
Building cool stuff, serving customers, and enjoying every moment of it...
View GitHub Profile
@sfcgeorge
sfcgeorge / wcg_ascii.txt
Last active January 11, 2022 09:09
Classic river crossing problem with both Python and Ruby implementations and ASCII output.
_##_
(..)
/ ~ \
|| ||
m|||m
|||
n^n
_.
)''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Solarized (dark)</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@hopsoft
hopsoft / Gemfile
Last active August 17, 2018 20:40
Add profiling to your rake tasks.
group :development do
gem "ruby-prof"
end
@joar
joar / donate-bitcoin.html
Last active September 27, 2023 07:48
Quick and dirty bitcoin donation button, as seen on https://gobblin.se
<style>
.donate-button {
text-align: center;
}
.donate-button .bitcoin-address {
font-size: 1.5em;
}
</style>
<div class="donate-button">
# http://rosettacode.org/wiki/Twelve_statements
#1. This is a numbered list of twelve statements.
#2. Exactly 3 of the last 6 statements are true.
#3. Exactly 2 of the even-numbered statements are true.
#4. If statement 5 is true, then statements 6 and 7 are both true.
#5. The 3 preceding statements are all false.
#6. Exactly 4 of the odd-numbered statements are true.
#7. Either statement 2 or 3 is true, but not both.
#8. If statement 7 is true, then 5 and 6 are both true.
@soulcutter
soulcutter / rubyprof.rake
Created April 14, 2012 06:17
Ruby profiling rake task
require 'ruby-prof'
require 'ruby-prof/task'
RubyProf::ProfileTask.new(:integration) do |t|
t.test_files = FileList['test/integration/**/patients_test.rb']
t.output_dir = File.join(Rails.root, 'tmp')
t.printer = :graph_html
t.min_percent = 10
end
@hiltmon
hiltmon / development_profiler.rb
Created February 28, 2012 03:55
Simple class to wrap a profile run around some code
class DevelopmentProfiler
def self.prof(file_name)
RubyProf.start
yield
results = RubyProf.stop
# Print a flat profile to text
File.open "#{Rails.root}/tmp/performance/#{file_name}-graph.html", 'w' do |file|
@adamcrown
adamcrown / .irbrc
Last active November 7, 2023 06:34
My Bundler proof .irbrc file including wirble, awesome_print, hirb, console logging and route helpers
require 'rubygems' unless defined? Gem # rubygems is only needed in 1.8
def unbundled_require(gem)
loaded = false
if defined?(::Bundler)
Gem.path.each do |gems_path|
gem_path = Dir.glob("#{gems_path}/gems/#{gem}*").last
unless gem_path.nil?
$LOAD_PATH << "#{gem_path}/lib"
@jamis
jamis / recursive-backtracker.rb
Created December 24, 2010 22:41
Implementation of the recursive backtracking algorithm for maze generation
# Recursive backtracking algorithm for maze generation. Requires that
# the entire maze be stored in memory, but is quite fast, easy to
# learn and implement, and (with a few tweaks) gives fairly good mazes.
# Can also be customized in a variety of ways.
DIRS = (N, S, E, W = 1, 2, 4, 8)
DX = { E => 1, W => -1, N => 0, S => 0 }
DY = { E => 0, W => 0, N => -1, S => 1 }
OPPOSITE = { E => W, W => E, N => S, S => N }