Skip to content

Instantly share code, notes, and snippets.

View adambair's full-sized avatar

Adam Bair adambair

View GitHub Profile
@adambair
adambair / .vimrc
Created June 10, 2019 21:44
Standup macro for vim
" Standup
map ,sup :let @z=strftime("#standup ```\ny:\nt:\nb: none\n```")<Cr>"zp
@mixin debug-label($text, $bg-color:#000000)
&:before
top: 0
right: 0
position: absolute
content: $text
color: #ffffff
z-index: 100
padding: 5px 10px 5px 10px
background-color: $bg-color
@adambair
adambair / full_setup_4k_monitor.txt
Last active January 19, 2016 18:54
4k Monitor Full Setup
4k Monitor Full Setup
Link: https://amzn.com/w/1XD2Y6UC0R7WT
This is my CURRENT monitor setup. I'm using it RIGHT NOW. I use all
day most days for programming / writing software / sysadmin tasks but
this thing is great for just about everything. I do play games
occasionally and it's great, I don't notice any issues, response delay,
or anything else. It just works.
Seriously, this setup (the whole thing, including camera, fully
@adambair
adambair / gist:ac03cae91c9539cd35aa
Created January 29, 2015 16:50
dsc-february-rompecabeza.rb
# Sum of it's parts
#
# Find a SIX digit number in which the
# FIRST digit is ONE more than the THIRD,
# the SCOND digit is ONE less than the
# FOURTH, the FIFTH digit is ONE less than
# the THIRD, and the SIXTH digit is ONE
# more than the FOURTH. The sum of the
# SECOND and the THIRD digits equal the
# FIRST. The sum of all digits is 30.
@adambair
adambair / gsub-hash.rb
Last active August 29, 2015 13:57
gsub replacement via hash
replace = {'{{HAPPY}}' => 'sad', '{{FUN}}' => 'lame', '{{BALLS}}' => 'rock'}
subject = "{{HAPPY}} {{FUN}} {{BALLS}} are amazing"
search = Regexp.new(replace.keys.map{|k,v| "(#{k})"}.join('|'))
parsed = subject.gsub(search, replace)
puts "old: #{subject}"
# => old: {{HAPPY}} {{FUN}} {{BALLS}} are amazing
puts "new: #{parsed}"
on develop
git co release-1.9.2
git merge --no-ff develop
git push
git co master
git merge --no-ff release-1.9.2
tig, look for last tag
git tag 1.9.2.x
git push
class AddExpiresAtToOffer < ActiveRecord::Migration
def change
add_column :offers, :expires_at, :date
Offer.reset_column_information
puts 'Setting expiration dates...'
Offer.find_each do |offer|
expiration_date = offer.created_at + 6.months
offer.update_column(:expires_at, expiration_date)
before_save :set_expiration_date
def expired?
expires_at > Time.now
end
def set_expiration_date
expires_at = Time.now + 6.months
end
@adambair
adambair / work-with-me.md
Last active December 18, 2015 00:58
Full-time Rails Developer at Openbay.com (Cambridge, MA) [06/03/13]

Full-time Rails Developer at Openbay.com (Cambridge, MA) [06/03/13]

Enjoy writing software? Software that takes the pain out of having your auto serviced? EXCELLENT. Join us at Openbay.com. We're an online marketplace that connects vehicle owners to service providers (mechanics, shops, etc) through real time quotes, payments, and messaging. Vehicle owners love us because it's easier and cheaper to get their car serviced; we take the guesswork out of choosing the right shop. Provders love us because they gain more customers while spending less on advertizing.

Still interested? On the fence? Questions? Is working for a starup risky? What will I be doing? Who will I be working with? Should I quit my job right now and join them (probably)? LET'S TALK (adam@openbay.com).

You'll be our second developer hire. You'll be working with me. For me? With me. We'll work together. Oh the beautiful things we shall build! When we're finished vehicles will practiclly fix themselves! Openbay already has real customers