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
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').to_a.permutation.to_a.shuffle.map(&:join)
tag_names_count = tag_names.count
max_id = ActsAsTaggableOn::Tag.maximum(:id)
@koffeinfrei
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}##{has_many_relation.name} relation" do
expect(has_many_relation.options[:dependent]).not_to be_nil
@koffeinfrei
koffeinfrei / README.md
Last active Sep 22, 2017
Idempotent seed helper for rails -> THIS IS NOW A GEM https://github.com/panter/seed_box
View README.md

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

View keybase.md

Keybase proof

I hereby claim:

  • I am koffeinfrei on github.
  • I am koffeinfrei (https://keybase.io/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
koffeinfrei / README.md
Last active Dec 11, 2018
how-to-contribute-a-metaflop-font
View README.md
View git-fame.sh
#!/bin/sh
# Help output
help() {
echo "Usage: git-fame [options] <repository_path>"
echo " -m Machine readable output"
echo " -h Print this help"
exit 1
}
@koffeinfrei
koffeinfrei / .gitignore
Last active Sep 3, 2016
Ruby system call benchmark
@koffeinfrei
koffeinfrei / README.md
Last active Aug 29, 2015 — forked from busterbenson/markov_tweets.rb
Horse koffeinfrei (markov twitter bot)
View README.md

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 dev.twitter.com, 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 Twitter.com -> 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.