Skip to content

Instantly share code, notes, and snippets.

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)
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
@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}"
@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 / 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
@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 / .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