Skip to content

Instantly share code, notes, and snippets.

View gmassanek's full-sized avatar

Geoff Massanek gmassanek

  • Reverb
  • Chicago, IL
View GitHub Profile
@gmassanek
gmassanek / benchmark.rb
Last active June 5, 2017 21:30
MLT vs OR query against prod
def converted_prices_for(price)
Currency.supported_for_selling.each_with_object({}) do |listing_currency, all_prices|
exchanged_amount = Reverb::ExchangeBanks
.exchange_with_inverse_paypal_rates(money: price, to_currency: listing_currency)
.cents
all_prices[listing_currency] = exchanged_amount
end
end
@gmassanek
gmassanek / geocode-xxx
Last active April 10, 2017 19:06
geocode_member_addresses
#!/usr/bin/env ruby
require 'json'
require 'net/http'
require 'pp'
member_data = JSON.parse(File.read('members.json'))
member_data.each do |leg_data|
need_geo = leg_data["offices"].select { |o| o["latitude"] == "xxx" }
next if need_geo == []
@gmassanek
gmassanek / gist:fb9327031029b40d4a97
Last active August 29, 2015 14:26
Go Profiling
==========================================================================================================================
// With Backtraces in steno logs
==========================================================================================================================
=============================================================== x10=======================================================
[geoff@dealestate-app1-staging ~]$ ab -n 5000 -c 10 http://gdag-app1-uat.snc1:8080/v1/deals/207bfbcb-ed30-4bd1-81e6-dbeafccdbc86
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
@gmassanek
gmassanek / gist:4464265
Last active December 10, 2015 16:58
Update .bashrc to change first bin directory
echo "export PATH=/usr/local/bin:$PATH" > ~/.bashrc
cat ~/.bashrc
@gmassanek
gmassanek / gist:3831390
Created October 4, 2012 03:58
BAHHHH Media Query triggering at 874px no 960px
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<style>
body { margin: 0; padding: 0;}
.codemarks {
width: 960px;
height: 500px;
margin: 0 auto;
background: blue;
@gmassanek
gmassanek / .gitconfig
Created April 10, 2012 21:58
.gitconfig
[user]
email = your_email
name = Your Name
[core]
editor = vim
[color]
ui = true
[alias]
st = status
ci = commit
@gmassanek
gmassanek / .zshrc
Created March 23, 2012 01:34
Alias to push and open chrome to the new pull request page
function git_remote_url() {
# DOES NOT WORK FOR HTTPS, ONLY git@github.com:username/repo.git
git config --get remote.origin.url | sed 's/git@//' | sed 's/github/https:\/\/github/' | sed 's/com:/com\//' | sed 's/\.git//'
}
function git_current_branch_name() {
git symbolic-ref HEAD | sed 's/refs\/heads\///'
}
function git_push_open() {
@gmassanek
gmassanek / gist:2036662
Created March 14, 2012 14:00
Vim Tricks from Editor Talk
cntl i
cntl o
hop between cursor positions
cntl u
cntl f
cntl d
cntl b
page and half page
@gmassanek
gmassanek / gist:2026304
Created March 13, 2012 03:00
Apache config to serve .com and redirect .org to .com
NameVirtualHost [ip_address]
<VirtualHost [ip_address]>
DocumentRoot /home/codemarks/www/codemarks/public
ServerName www.codemarks.com
ServerAlias codemarks.com
RailsEnv production
<Directory /home/codemarks/www/codemarks/public>
AllowOverride all
Options -MultiViews
class PagesController < ApplicationController
def home
@title = "Home"
puts flash[:notice]
@subscription = Subscription.new
@announcements = Announcement.find(:all, :order => 'updated_at DESC')
end
end
home.html.erb contains: