Skip to content

Instantly share code, notes, and snippets.

View joncalhoun's full-sized avatar
💻
Making Go Courses

Jon Calhoun joncalhoun

💻
Making Go Courses
View GitHub Profile
@joncalhoun
joncalhoun / ..README.md
Last active May 30, 2023 05:29
Most of my settings for a new mac

Chrome

  • Download & install Chrome
  • Login & sync settings/whatever else

Mac OS settings

  • General -> Use dark menu bar
  • General -> Default web browser: Google Chrome
gotest() {
go test $* | sed ''/PASS/s//$(printf "\033[32mPASS\033[0m")/'' | sed ''/FAIL/s//$(printf "\033[31mFAIL\033[0m")/'' | sed ''/FAIL/s//$(printf "\033[31mFAIL\033[0m")/'' | GREP_COLOR="01;33" egrep --color=always '\s*[a-zA-Z0-9\-_.]+[:][0-9]+[:]|^'
}
// The builder pattern makes it really hard to return errors during a build
// step. Consider using functional options instead, which work much better with
// incremental errors.
// Let's say you have the builder pattern.
type T struct { ... }
func (t *T) A(arg string) *T {
// do stuff here with t and arg
return t
@joncalhoun
joncalhoun / cloudSettings
Last active August 17, 2020 14:57
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-08-17T14:57:52.730Z","extensionVersion":"v3.4.3"}
type Messenger struct {
// Add this field here
Client *http.Client
mux *http.ServeMux
messageHandlers []MessageHandler
deliveryHandlers []DeliveryHandler
readHandlers []ReadHandler
postBackHandlers []PostBackHandler
optInHandlers []OptInHandler
tests=($(ls spec/features))
for i in "${tests[@]}"; do
firstChar=${i:0:1}
if [[ $firstChar < "l" ]]
# Replace this w/ test running.
then echo "bundle exec rspec spec/features/$i"
fi
done
@joncalhoun
joncalhoun / easypost-curl.sh
Created October 29, 2012 16:55
EasyPost cURL Example
curl https://www.easypost.co/api/postage/list \
-u cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi:
@joncalhoun
joncalhoun / output.json
Created October 29, 2012 16:21
EasyPost cURL Example Output
{
"rates":[
{
"carrier":"USPS",
"service":"Priority",
"rate":"15.30"
}
]
}
@joncalhoun
joncalhoun / easypost-curl.sh
Created October 29, 2012 16:21
EasyPost cURL Example
curl https://www.easypost.co/api/postage/rates \
-u cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi: \
-d 'to[zip]=94107' \
-d 'from[zip]=94019' \
-d 'parcel[predefined_package]=LargeFlatRateBox' \
-d 'parcel[weight]=100.0'
@joncalhoun
joncalhoun / output.json
Created October 29, 2012 16:17
EasyPost cURL Example Output
{
"error":"Invalid sender data."
}