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
View recruiter_wtf.txt
From: Eldrich_AikonTech eldrich@aikontechnologiesinc.com
Subject: Immediate Role: Ruby and Rail Developer - CA
I hope you are doing well. Just writing to check your availability for new project. I have an opportunity for you. Please have a look at it and let me know your interest with your latest resume and following details ASAP.
Full Name:
Contact No. :
Email ID:
Work authorization (H1B/GC/Citizen):
Current Location (City, State):
@bf4
bf4 / colorize.rb
Last active Aug 29, 2015
ansi terminal colorize
View colorize.rb
# see https://github.com/rubychan/coderay/blob/master/lib/coderay/encoders/terminal.rb
# https://rubygems.org/gems/text-highlight
module Colorize
ESCAPE_CODES_PATTERN = Regexp.new('\e\[(?:\d;)?\d{1,2}m')
module ColorCode
module_function
def color(name, background=false)
number = case name
when 'black' then 30
when 'red' then 31
View acts_as_slimgems.patch
diff --git a/Gemfile b/Gemfile
index 22bde6e..a429815 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,5 +1,15 @@
source 'https://rubygems.org'
+require 'rubygems'
+def Gem.source_index
+ STDERR.puts "Guess who wants Gem.source_index? #{caller[0]}"
@bf4
bf4 / program.pdf
Last active Aug 29, 2015
RailsConf Program
View program.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bf4
bf4 / decode_this.txt
Created Apr 20, 2014
crazy jobs postings
View decode_this.txt
http://chicago.craigslist.org/chc/eng/2994616197.html
Need highly skilled developers (Chicago)
Date: 2012-05-03, 4:52PM CDT
Reply to: see below
Too many unqualified candidates reply to our job postings, thus making the exceptional candidates hard to find. So, we've decided to raise the bar. We are looking for extraordinarily talented front-end developers (JavaScript/jQuery), Java Developers and Ruby on Rails developers. We provide credible access to many of the top tier interactive agencies, eCommerce companies, Financial firms, etc. in Chicago and nationwide. To apply for any of these positions you need to extract our contact info from the bottom of this ad. Once you decipher the code, send us a copy of your resume and we will contact you straight away. /* Must be authorized to work for any employer without restriction. No sponsorship. No telecommute */
/iw/wVOQboJrt13F26QK7BbtB/qq/gDmAPvWVW5WSiCp7nuxY5Em9vXKJpIK7r8Qp5Cu0PqAZsY/oavwTZE7rL+91wdu6uDDBadZ/tA/gA==
@bf4
bf4 / bench.rb
Last active Aug 29, 2015
Benchmarking to_s vs. &&=. Result: &&= is faster
View bench.rb
require 'benchmark/ips'
ENV = {}
Benchmark.ips do |x|
x.report("to_s, then to_s", "content_type = ENV['CONTENT_TYPE'].to_s.split(/\s*[;,]\s*/, 2).first.to_s.downcase")
x.report("to_s, then &&=", "content_type = ENV['CONTENT_TYPE'].to_s.split(/\s*[;,]\s*/, 2).first; content_type &&= content_type.downcase")
x.report("&&=, then &&=", "content_type = ENV['CONTENT_TYPE']; content_type &&= content_type.split(/\s*[;,]\s*/, 2).first; content_type &&= content_type.downcase")
end
@bf4
bf4 / airbrake_client.rb
Created May 21, 2014
Airbrake client api
View airbrake_client.rb
#!/usr/bin/env ruby
#v3 api
#https://airbrake.io/api/v3/projects?key=KEY
#https://airbrake.io/api/v3/projects/PROJECT_ID/groups?key=KEY
#https://airbrake.io/api/v3/projects/PROJECT_ID/groups/GROUP_ID?key=KEY
#https://airbrake.io/api/v3/projects/PROJECT_ID/groups/GROUP_ID/notices?key=KEY
#https://airbrake.io/api/v3/projects/PROJECT_ID/groups/GROUP_ID/last-notice?key=KEY
#https://airbrake.io/api/v3/projects/PROJECT_ID/group-environments?key=KEY
#https://airbrake.io/api/v3/projects/PROJECT_ID/deploys?key=KEY
#https://airbrake.io/api/v3/projects/PROJECT_ID/deploys/GROUP_ID?key=KEY
@bf4
bf4 / server.sh
Created May 28, 2014
passenger server starting script
View server.sh
#!/usr/bin/env bash
# ./serve setup
# ./serve.sh start
# with jruby, can't daemonize so
# ./serve.sh start jruby
# TODO see if instead of checking for $2
# we can check if $RUBY_VERSION matches jruby
if [ ! -n "$1" ]
then
echo "Usage: ./serve.sh [start|stop|restart|status|setup]"
@bf4
bf4 / rails_background_sender.rb
Created Jun 22, 2014
Rails Mail background sender
View rails_background_sender.rb
module BackgroundSender
def self.serialize_mail(mail)
s = ""
# Mail#encoded strips bcc so we must add it manually
s << "Bcc: #{mail.bcc.join(", ")}\r\n" if mail.bcc.present?
s << mail.encoded
s
end
def self.deserialize_mail(serialized_mail)
@bf4
bf4 / ABOUT.md
Last active Aug 29, 2015
Bootstrap OSX Workstation Ruby/Homebrew/Git
View ABOUT.md

Install as follows

\curl -sSL https://gist.github.com/bf4/38774a5e48660b264bde/download | \
  tar xzvf - --include '*setup' -O | bash
You can’t perform that action at this time.