Skip to content

Instantly share code, notes, and snippets.

View amattn's full-sized avatar

Matt Nunogawa @amattn amattn

View GitHub Profile
@amattn
amattn / ASSERT_NIL_MotW.m
Created March 6, 2011 19:47
Objective C Macro of the week: ASSERT_NIL // used to guarantee that a given object is nil.
#define ASSERT_NIL(x) NSAssert4((x == nil), @"\n\n **** Unexpected Nil Assertion ****\n **** Expected nil, but " #x @" is not nil.\nin file:%s at line %i in Method %@ with object:\n %@", __FILE__, __LINE__, NSStringFromSelector(_cmd), self)
@amattn
amattn / MacroOfTheWeek.h
Created September 1, 2011 23:57
Objective C Macro of the week: ASSERT_IS_CLASS
#define ASSERT_IS_CLASS(x, class) NSAssert5([x isKindOfClass:class], @"\n\n **** Unexpected Assertion **** \nReason: Expected class:%@ but got:%@\nAssertion in file:%s at line %i in Method %@", NSStringFromClass(class), x, __FILE__, __LINE__, NSStringFromSelector(_cmd))
@amattn
amattn / newtemplate.txt
Created September 3, 2011 00:51
Golang New (2011) template example go & template File
type Entry struct {
Title string
Content string
}
entry := make(Entry)
entry.Title = "New Go Templates (mid-2011)"
entry.Content = "A trivial example of how to use them. see documentation and Go source code/tests for more examples"
@amattn
amattn / SHOULD_NEVER_GET_HERE.h
Created October 7, 2011 00:34
Objective C Macro of the week
#define SHOULD_NEVER_GET_HERE NSAssert4(FALSE, @"\n\n **** Should Never Get Here **** \nAssertion in file:%s at line %i in Method %@ with object:\n %@", __FILE__, __LINE__, NSStringFromSelector(_cmd), self)
@amattn
amattn / automatedBuildAndUploadToTestflight.sh
Created April 17, 2012 23:24
Automated Xcode build and upload to TestFlight.
#!/bin/sh
# Current as working as of 2012/4/17
# Xcode 4.3.2
PROJECT_ROOT="$HOME/SomeDirWhereYourProjectLives/XXXXXXXX"
WORKSPACE="$PROJECT_ROOT/XXXXXXXX.xcodeproj/project.xcworkspace"
CONFIG="AdHoc"
SCHEME="XXXXXXXX"
@amattn
amattn / riak.go
Created September 10, 2012 17:58
Rough draft of a golang Riak driver
// Package riak is an opinionated driver for the Riak datastore
// Developed against Riak 1.2
//
// Design decisions were made to prioritize safety over absolute ease of use.
// This is a work in progress, but could be good starting point for your own custom driver
// Eventually, there will be a real repo.
// Also on the roadmap is protocol buffer support, multi-node clusters, better sibling
// resolution and even client-side CRDTs
//
// If you have any feedback, please let me know.

Keybase proof

I hereby claim:

  • I am amattn on github.
  • I am amattn (https://keybase.io/amattn) on keybase.
  • I have the public key with fingerprint A9AD 6782 656D 3E83 C67B  8B56 DFDA DA1B 1538 2CEB

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am amattn on github.
  • I am amattn (https://keybase.io/amattn) on keybase.
  • I have the public key with fingerprint A9AD 6782 656D 3E83 C67B  8B56 DFDA DA1B 1538 2CEB

To claim this, I am signing this object:

@amattn
amattn / deploy.sh
Last active September 9, 2023 05:41
#!/bin/sh
set -o nounset
set -o errexit
usage(){
echo "Usage: $0 X.Y.Z dev|test|staging|prod"
echo ""
echo "example: ./deploy.sh 1.1.3 prod"
echo "example: ./deploy.sh 1.2.0 dev"
@amattn
amattn / Dockerfile
Created January 6, 2021 17:44
Dockerfile example used to build an elixir/phoenix project on linux and output a tarball
FROM elixir:1.11.2 AS build
## instll some dependencies (webpack basically)
RUN \
apt-get update -y && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs && node -v && npm -v
# Required environment variables passed in via --build-arg flags