Skip to content

Instantly share code, notes, and snippets.

View seanho's full-sized avatar

Sean Ho seanho

View GitHub Profile
@danielmartin
danielmartin / BetterXcodeJumpToCounterpartSwift.org
Last active March 13, 2025 11:08
Add support for a better Xcode's Jump to Next Counterpart in Swift

If you work on a Swift project that follows the Model-View-ViewModel (MVVM) architecture or similar, you may want to jump to counterpart in Xcode from your view to your model, and then to your view model. (ie. by using Ctrl+Cmd+Up and Ctrl+Cmd+Down).

You can do this in recent versions of Xcode by setting a configuration default.

From a terminal, just type this command and press Enter:

defaults write com.apple.dt.Xcode IDEAdditionalCounterpartSuffixes -array-add "ViewModel" "View"
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@kinopyo
kinopyo / gist:1062397
Created July 3, 2011 17:17
How to install coffee-script, and how to enable textmate bundler to compile coffeescript
# don't forget to update your port tree first
sudo port selfupdate
# install coffee script using macport
sudo port install nodejs
node -v
# install npm - the Node Package Manager
git clone http://github.com/isaacs/npm.git
cd npm
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
@JeremySkinner
JeremySkinner / 01_Demo.cs
Created January 23, 2011 21:21
A little strongly-typed wrapper around WebMatrix.Data - this is now its own project at https://github.com/JeremySkinner/WebMatrix.Data.StronglyTyped
// WebMatrix.Data's Query method returns an IEnumerable<dynamic>
// While this is great for simple scenarios, if you want to add behaviour to your DB objects
// then it can be a pain. Here's a simple wrapper that adds a strongly-typed Query method
// This is a simple implementation and could be improved.
// Represents a table in the database
public class User {
public int Id { get; set; }
public string Name { get; set; }
}
@ishikawa
ishikawa / gist:23429
Created November 10, 2008 05:45
Core Text related utilities
/**
* Returns the lowest index of the matching line in the frame,
* or -1 if no line in the frame matched.
*/
static CFIndex MTFrameGetFirstLine(CTFrameRef frame, CFIndex charIndex, CTLineRef *found, CFRange *characterRange)
{
const CFArrayRef lines = CTFrameGetLines(frame);
CFIndex l = 0, u = CFArrayGetCount(lines);
while (l < u) {
const CFIndex m = l + ((u - l) / 2);