Skip to content

Instantly share code, notes, and snippets.

Benjamin Fleischer bf4

Block or report user

Report or block bf4

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
bf4 / find_relations_in_batches.rb
Created Mar 22, 2017
ActiveRecord Rails Find Relations in Batches
View find_relations_in_batches.rb
# Finds and yields relations in batches. Adapted from record.find_in_batches since that yields
# arrays and we want to operate on relationships.
# Adapted from:
def find_in_batches(target, batch_size: default_batch_size, start: nil)
relation = target
if logger && (target.arel.orders.present? || target.arel.taken.present?)
logger.warn("Scoped order and limit are ignored, it's forced to be batch order and batch size")
relation = relation.reorder(target.send(:batch_order)).limit(batch_size)
bf4 / go_kinesis_with_structs.go
Created Mar 14, 2017 — forked from pricees/go_kinesis_with_structs.go
Go + AWS Kinesis + Encode/Decode Structs
View go_kinesis_with_structs.go
Assumes env contains aws credentials:
and AWS_REGION_NAME (e.g. 'US-EAST-1')
see EnvAuth() below
View 2014-09-30-sample.rb = 'Person Name <>'
message.subject = 'Sample Subject'
# body is probably good enough, but you can set text_part/html_part below if you like
message.body = <<HERE.strip
This is a sample
bf4 / dontforget.bash
Created Feb 20, 2017 — forked from ttscoff/dontforget.bash
Quick reminders from Terminal (bash)
View dontforget.bash
# dontforget
# A stupid script for short term reminders in bash
# Arguments just need to contain a number and a bunch of words.
# The number can be anywhere in the arguments, but there shouldn't
# be any other numeric digits.
bf4 / _dev_badge.html.slim
Created Feb 1, 2017 — forked from stevenharman/_dev_badge.html.slim
A simple badge that shows your Rails environment.
View _dev_badge.html.slim
/ In app/views/shared/
span= Rails.env
span It ain't production!
View sidekiq_with_github.rb
require 'warden/github'
class SidekiqGithubChecker
def self.registered(app)
app.helpers do
def warden; env['warden'] end
def github_organization_authenticate!(name)
unless warden.user.organization_member?(name)
halt [401, {}, ["You don't have access to organization #{name}"]]
bf4 /
Created Jan 16, 2017 — forked from jjb/
Trying to figure out performance impact of RUBY_GC_HEAP_GROWTH_FACTOR
bf4 /
Created Jan 6, 2017 — forked from leonardofed/
A curated list of AWS resources to prepare for the AWS Certifications

A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


bf4 / all_aws_lambda_modules.txt
Created Dec 15, 2016 — forked from gene1wood/
AWS Lambda function to list all available Python modules and post the list to Pastebin
View all_aws_lambda_modules.txt
# module list (generated by
# timestamp='20160226T200954Z'
# sys.version='2.7.10 (default, Dec 8 2015, 18:25:23) \n[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]'
# sys.platform='linux2'
# platform='Linux-4.1.13-19.31.amzn1.x86_64-x86_64-with-glibc2.2.5'
You can’t perform that action at this time.