Skip to content

Instantly share code, notes, and snippets.


Alexis Reigel koffeinfrei

Block or report user

Report or block koffeinfrei

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
koffeinfrei / generate_many_runner_tags.rb
Last active Dec 11, 2018
generate a lot of random ActsAsTaggableOn::Tag
View generate_many_runner_tags.rb
require 'bulk_insert'
old_logger = ActiveRecord::Base.logger
ActiveRecord::Base.logger = nil
model = WhateverModel.find_by(whatever: 'something')
tag_names = ('a'..'i')
tag_names_count = tag_names.count
max_id = ActsAsTaggableOn::Tag.maximum(:id)
koffeinfrei / .ruby-version
Created Mar 14, 2018 — forked from aishfenton/serializer_benchmarks.rb
Performance comparison of different ruby serializer methods
View active_record_base_spec.rb
# File: spec/models/base_spec.rb
require 'rails_helper'
RSpec.describe 'All ActiveRecord::Base models' do
context 'has_many with :dependent key' do
each_active_record_model do |model|
has_many_relations(model).each do |has_many_relation|
it "has :dependent defined on the #{model}##{} relation" do
expect(has_many_relation.options[:dependent]).not_to be_nil
koffeinfrei /
Last active Sep 22, 2017
Idempotent seed helper for rails -> THIS IS NOW A GEM

Idempotent seed helper for rails

  • The first model argument is the model class
  • The second argument find_or_create_by is a hash of attributes that are used for finding a record. If the record doesn't exist, it will be created. This hash is like the unique identifier of a seed record.
  • The third argument update_with is a hash of attributes that will be always set on the record, whether the record already exists or has to be created. This is useful when the seeds are extended and you want to update existing records with new attributes.

Example usage


Keybase proof

I hereby claim:

  • I am koffeinfrei on github.
  • I am koffeinfrei ( on keybase.
  • I have a public key whose fingerprint is 26F1 300F 4F40 F679 66F0 A62D B0B7 DE56 128A 5B8F

To claim this, I am signing this object:

koffeinfrei /
Last active Dec 11, 2018
# Help output
help() {
echo "Usage: git-fame [options] <repository_path>"
echo " -m Machine readable output"
echo " -h Print this help"
exit 1
koffeinfrei / .gitignore
Last active Sep 3, 2016
Ruby system call benchmark
koffeinfrei /
Last active Aug 29, 2015 — forked from busterbenson/markov_tweets.rb
Horse koffeinfrei (markov twitter bot)

Getting started

  1. Setup new horse twitter account
  • Create a new Twitter account that you'd like to have your auto-tweets posted to
  • Go to, create a new application with Read+Write permissions
  • Create an access token + secret for the account and copy that and the consumer key and secrets.
  1. Get your twitter archive
  • Go to -> Settings -> Download Archive.
  • The tweets.csv file is in the top directory. Put it in the same directory as this script.
View svn_authors.rb
# Koffeinfrei svn_authors.rb
# Copyright (C) 2011 Alexis Reigel
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
You can’t perform that action at this time.