Skip to content

Instantly share code, notes, and snippets.

Calvin Correli calvincorreli

View GitHub Profile
@calvincorreli
calvincorreli / bluesmart.md
Last active Jul 13, 2016
Bluesmart suitcase feedback
View bluesmart.md
  • I don't trust the lock via the app, so I keep the key in the front pocket of the suitcase, defeating the purpose of the lock. Why? What if the suitcase is dead becasue I forgot to charge it? Also, I've often experienced that the app doesn't connect with the suitcase, or takes a long time to connect. Then what? I don't have the patience to wait for that.

  • Right now: Suitcase has been charging overnight, is plugged in, I press the button behind the handle, nothing happens, the app is still searching for the app and can't connect. I can't risk this in a situation where I'm stuck at the airport. Maybe my suitcase is just broken?

  • Closing the suitcase is finicky. You have to close it at exactly the right angle for it to work.

  • Getting my 15" MacBook Pro down in the laptop holder is often problematic. The sides are too soft, I have to hold out one side while I put it down, or it catches one side and won't go in.

  • It cause problems in Copenhagen airport. They needed to call in a supervisor to make sure it

View keybase.md

Keybase proof

I hereby claim:

  • I am calvincorreli on github.
  • I am calvincorreli (https://keybase.io/calvincorreli) on keybase.
  • I have a public key ASBnKrZ3pSonmmTeqYIHewYlHVvHsH7at2ia7ujr3Af2hwo

To claim this, I am signing this object:

@calvincorreli
calvincorreli / kill-adobe-updater.sh
Created Jul 17, 2014
Kill the stupid annoying Adobe updater icon in the menu bar
View kill-adobe-updater.sh
cd ~/Library/LaunchAgents
launchctl remove com.adobe.AAM.Scheduler-1.0
rm com.adobe.AAM.*
pkill "AAM Updates"
@calvincorreli
calvincorreli / post-commit
Created Feb 7, 2014
Improved it a bit, so it says what it's doing, and defaults to master when there's no branch-specific setting
View post-commit
#! /bin/zsh
branch_name=${$(git symbolic-ref HEAD)#refs/heads/}
function switch {
echo "Switching to database.yml.branch.${1}"
cp config/database.yml config/database.yml.branch.bak
cp config/database.yml.branch.${1} config/database.yml
}
@calvincorreli
calvincorreli / middleware.rb
Created Mar 19, 2013
Middleware to fix the problem with Sendgrid sending webhook POSTs with an incorrect application/json content type even though the content is actually a sequence of JSON structures separated by line breaks. Rails will try to parse the contents as a JSON document and fail. This middleware changes the content type to application/sendgrid-json, thus…
View middleware.rb
Billing::Application.configure do
config.middleware.insert_before "ActionDispatch::ParamsParser", SendgridWebhookMiddleware
end
@calvincorreli
calvincorreli / model.rb
Created Oct 17, 2012
Code to render a view from inside a model
View model.rb
def render_to_string
I18n.with_locale(locale) do
Renderer.render(
file: "purchase_mailer/invoice",
layout: nil,
assigns: { charge: self, purchase: purchase, product: product, account: account, payments: payments }
)
end
end
@calvincorreli
calvincorreli / pusher.js.coffee
Created Oct 14, 2012
Simple wrapper library for Pusher with the ability to replay recent events (< 2 minutes ago)
View pusher.js.coffee
class window.ZenPusher
@pusher: null
@channel: []
constructor: ->
setupPusher: _.once ->
@pusher = new Pusher($('body').data('pusher-key'))
channel: (channel) ->
@calvincorreli
calvincorreli / spreedly-core-api.txt
Created Sep 4, 2012 — forked from ntalbott/spreedly-core-api.txt
Overview of Spreedly Core API endpoints
View spreedly-core-api.txt
OPTIONS https://spreedlycore.com/v1/gateways.xml => list supported gateways
POST https://spreedlycore.com/v1/gateways.xml => add a gateway
GET https://spreedlycore.com/v1/gateways.xml => list all added gateways
PUT https://spreedlycore.com/v1/gateways/token.xml => Update gateway
PUT https://spreedlycore.com/v1/gateways/token/redact.xml => Remove sensitive gateway data
POST https://spreedlycore.com/v1/gateways/token/purchase.xml => purchase - supply a payment method token also
POST https://spreedlycore.com/v1/gateways/token/authorize.xml => authorize - supply a payment method token also
POST https://spreedlycore.com/v1/payment_methods => Capture credit card from form - transparent redirect magic
GET https://spreedlycore.com/v1/payment_methods.xml => list all retained credit cards
@calvincorreli
calvincorreli / spreedly-core-api.txt
Created Sep 2, 2012
Overview of Spreedly Core API endpoints
View spreedly-core-api.txt
OPTIONS https://spreedlycore.com/v1/gateways.xml => list supported gateways
POST https://spreedlycore.com/v1/gateways.xml => add a gateway
GET https://spreedlycore.com/v1/gateways.xml => list all added gateways
POST https://spreedlycore.com/v1/gateways/token/purchase.xml => purchase - supply a payment method token also
POST https://spreedlycore.com/v1/gateways/token/authorize.xml => authorize - supply a payment method token also
POST https://spreedlycore.com/v1/payment_methods => Capture credit card from form - transparent redirect magic
GET https://spreedlycore.com/v1/payment_methods.xml => list all retained credit cards
POST https://spreedlycore.com/v1/payment_methods/token/retain.xml => Store credit card info
POST https://spreedlycore.com/v1/payment_methods/token/redact.xml => Remove credit card info
View cc_fees.rb
def estimate_fee(cents, cardtype)
case cardtype.to_s.downcase
when /dankort/
# Dankort:
# http://www.pbs.dk/da/produkter/dankort/Documents/DK_Prisliste_Dankort_eDankort_DK.pdf
# Transaction size Price
# 0 - 50.00 DKK 0.70 DKK
# 50.01 - 100.00 DKK 1.10 DKK
# > 100.01 1.45 DKK + 0.1%
# Using this: 1.45 DKK + 0.10%
You can’t perform that action at this time.