Skip to content

Instantly share code, notes, and snippets.

@ehuynh
ehuynh / prepare-commit-msg
Last active June 3, 2021 10:45
prepare-commit-msg hook for populating commit message template with the JIRA ticket number as a prefix
#!/bin/sh
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
#/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# Include any branches for which you wish to disable this script
if [ -z "$BRANCHES_TO_SKIP" ]; then
@ehuynh
ehuynh / swift-cheat-sheet.md
Last active February 23, 2018 08:31
Swift Cheat Sheet

Basic

Integers

Int

In most cases, you don't need to pick a specific size of integer to use in your code. Swift provides an integer type, Int, which has the same size as the current platform's native word size:

  • On a 32bit platform, Int is the same size as Int32
  • On a 64bit platform, Int is the same size as Int64
#!/usr/bin/env ruby
###########################################################################
# Script to be called as an Xcode 4 behaviour which will attempt to
# uncrustify all source files in the open project.
#
# (c) Copyright 2012 David Wagner.
#
# Complain/commend: http://noiseandheat.com/
#
#*************************************************************************#
@ehuynh
ehuynh / xcode-shortcuts.md
Last active October 20, 2016 17:49
Xcode shortcuts
  • ⌘ - command
  • ⌥ - option
  • ⌃ - control
  • ⇧ - shift
  • ⏎ - return
Command KeyBinding
Jump to definition ⌃⌘J
Show standard editor ⌘⏎
#!/usr/bin/env ruby
###########################################################################
# Script to be called as an Xcode 4 behaviour which will attempt to
# uncrustify all source files in the open project.
#
# (c) Copyright 2012 David Wagner.
#
# Complain/commend: http://noiseandheat.com/
#
#*************************************************************************#
@ehuynh
ehuynh / gist:3097687
Created July 12, 2012 11:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@ehuynh
ehuynh / gist:2572398
Created May 1, 2012 23:37
Start and Stop Jenkins on OSX
# start
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
# stop
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
@ehuynh
ehuynh / rvm-commands.md
Created April 24, 2012 03:39
RVM Commands

Rubies

  • list rubies available rvm list rubies

  • use ruby rvm use 1.9.3

Gemsets

  • create a rvmrc project file for project using ruby 1.9.3 rvm --rvmrc --create 1.9.3@projectname

Setting up command line tools

Change the Xcode path sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer Create a script folder mkdir scripts Make a copy of the RunPlatformUnitTests file into your scripts folder cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/RunPlatformUnitTests scripts/ Update line 95 from Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)." to

@ehuynh
ehuynh / gist:2396566
Created April 16, 2012 05:48
iOS Singleton
static MyObject *singleton = nil;
+(MyObject *) sharedInstance {
NSLog (@"sharedInstance called.");
if (nil != singleton) return singleton;
static dispatch_once_t predicate;
dispatch_once(&predicate, ^{
singleton = [[MyObject alloc] init];