Skip to content

Instantly share code, notes, and snippets.

View kotp's full-sized avatar
enjoying life

Victor Goff kotp

enjoying life
View GitHub Profile
@belgoros
belgoros / palindrome_products.rb
Last active July 28, 2022 06:01
Exercisme: palindromes exercise
class Palindromes
private
attr_reader :factors, :max_factor, :min_factor, :palindromes
def initialize(min_factor: 1, max_factor: 1)
@min_factor = min_factor
@max_factor = max_factor
@factors = (min_factor..max_factor).to_a
@palindromes = palindromes

I was asked to share a few memories of Jim Weirich as someone prepared for a conference talk about him, so I figured I'd share what came to mind here:

  1. My cofounder Todd Kaufman would often refer to Jim as the "Santa Claus of the Ruby community". He was a big, jolly guy and he always brought joy to every room he was in. If people take away one thing to know about Jim, it's that even when he had 30 years of experience on someone, he always treated them with tremendous deference and respect. He always approached my ideas and questions as if they were urgent and fascinating, even if he'd encountered them dozens of times before. It's a trait I strive to imitate whenever I meet people at a user group or a conference, because it made such an impact on me when someone that I looked up to treated me like my experiences mattered to them.

  2. I would sometimes drive 2 hours from Columbus to Cincinnati just to hang out at Jim's office. No matter what client work he had to do, he was never too busy for me. I remember

@JoelQ
JoelQ / math.rb
Last active June 30, 2021 20:41
Derive addition, multiplication, and exponentiation from from `Integer#next`
def add(number1, number2)
number2.times.reduce(number1) { |total| total.next }
end
add(2,3)
# => 5
def subtract(number1, number2)
number2.times.reduce(number1) { |total| total.pred }
end
@JoelQ
JoelQ / inter-group-edges.md
Created June 20, 2018 17:15
Edges to different groups

Problem

You have a graph where the nodes are in groups. You want to create edges between all nodes that are in different groups.

For example, given the following groups:

[[1, 2], [3], [4, 5]]
@JoshCheek
JoshCheek / evolution
Created August 2, 2016 17:47
Terminal L-System in a tweet
Posted here https://twitter.com/josh_cheek/status/760519587758690304
Previously https://twitter.com/josh_cheek/status/667501443226558464
Based on http://algorithmicbotany.org/papers/abop/abop-ch1.pdf
ruby -e 's = "F-F-F-F"; 3.times { s = s.gsub /f/i, "F" => "FF-F-F-F-FF" };
dirs = [" \e[2D\e[A", " ", " \e[2D\e[B", " \e[4D"].map { |s| s * 2 }
print "\e[H\e[2J\e[60;20H\e[45m" # clear and "center"
s.each_char { |c| c == "F" ? print("\e[45m",dirs[0]) : c == "f" ? print("\e[49m", dirs[0]) : c == "-" ? dirs.rotate!(1) : c == "+" ? dirs.rotate!(-1) : :noop }
puts'
@arxae
arxae / fossil-git.txt
Created August 2, 2016 06:55
Fossil <-> Git
Fossil -> Git
git init new-repo
cd new-repo
fossil export --git ../repo.fossil | git fast-import
git merge trunk
git branch -d trunk
Git -> Fossil
cd git-repo
import UIKit
import MapKit
import Parse
class MapViewController: UIViewController, CLLocationManagerDelegate,
MKMapViewDelegate, UISearchBarDelegate {
override func shouldAutorotate() -> Bool {
return false
}
@tenderlove
tenderlove / mt_complete.rb
Last active December 11, 2020 19:56
tab completion for minitest tests
#!/usr/bin/env ruby --disable-gems
# Tab completion for minitest tests.
#
# INSTALLATION:
#
# 1. Put this file in a directory in your $PATH. Make sure it's executable
# 2. Run this:
#
# $ complete -o bashdefault -f -C /path/to/this/file.rb ruby
@y-yagi
y-yagi / gist:b0504a365625295d6d97
Created December 6, 2014 05:55
minitest-sound test script
require 'minitest/autorun'
require 'minitest/sound'
Minitest::Sound.success = '/home/yaginuma/Dropbox/tmp/music/other/sey.mp3'
Minitest::Sound.failure = '/home/yaginuma/Dropbox/tmp/music/other/mdai.mp3'
Minitest::Sound.during_test = '/home/yaginuma/Dropbox/tmp/music/other/rs1_25_beatthemup.mp3'
class A
def b
sleep 5
@damianesteban
damianesteban / server.js
Created November 21, 2014 18:25
server
// server.js
// BASE SETUP
// ==================================================================
// call the packages we need
var express = require('express'); // call express
var app = express(); // define our app using Express
var bodyParser = require('body-parser');
var mongoose = require('mongoose'); // Our Database