Skip to content

Instantly share code, notes, and snippets.

@evocateur
evocateur / fixconsolas
Created March 15, 2009 00:15
Fix Consolas's line-height on OS X
#!/bin/bash
#
# Requires ftxdumperfuser from http://developer.apple.com/textfonts/download/
#
# Usage: fixconsolas [files ...]
# When called with no arguments, it attempts to operate on every TrueType
# file in the current directory.
#
# References:
# http://bandes-storch.net/blog/2008/12/21/consolas-controlled/#comment-2042
@Abizern
Abizern / git versioner
Created October 12, 2009 23:05
Xcode build script that adds the commit sha to the CFBundleVersion
#!/usr/bin/env ruby
# Xcode auto-versioning script for Subversion by Axel Andersson
# Updated for git by Marcus S. Zarra and Matt Long
# Converted to ruby by Abizer Nasir
# Appends the git sha to the version number set in Xcode.
# see http://www.stompy.org/2008/08/14/xcode-and-git-another-build-script/ for more details
# These are the common places where git is installed.
# Change this if your path isn't here
@implementation NSString (HexStuff)
- (NSUInteger)hexValue
{
NSUInteger i = 0;
// -- strip leading #
if( [self hasPrefix:@"#"] )
i++;
[OUIAnimationSequence runWithDuration:0.3
actions:
^{
// step 1
},
^{
// step 2
},
^{
@incanus
incanus / GitTagBundleVersion.sh
Created December 22, 2010 02:23
This is an Xcode build script that will automatically change your app's Info.plist CFBundleVersion string to match the latest git tag for the working copy. If you have commits beyond the last tagged one, it will append a 'd' to the number.
#/bin/sh
INFO=$( echo $PWD )/MyApp-Info
TAG=$( git describe --tags `git rev-list --tags --max-count=1` )
COMMIT=
GITPATH=/usr/bin:/usr/local/bin:/usr/local/git/bin
PATH=$PATH:$GITPATH; export PATH
if [ -z $( which git ) ]; then
echo "Unable to find git binary in \$GITPATH"
@Abizern
Abizern / update_git.py
Created January 11, 2011 10:25
Replace a Git installation in /usr/bin/ with symlinks to a preferred git installation.
#!/usr/bin/env python -tt
"""Xcode4 installs and expects to find a git installation at /usr/bin.
This is a pain if you want to control your own installation of git that
might be installed elsewhere. This script replaces the git files in
/usr/bin with symlinks to the preferred installation.
Update the 'src_directory' to the location of your preferred git installation.
"""
import sys
@0xced
0xced / NSData+CommonDigest.h
Created May 23, 2011 09:00
NSData+CommonDigest: The most elegant NSData category for cryptographic hash functions
/*
Licensed under the MIT License
Copyright (c) 2011 Cédric Luthi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@AlanQuatermain
AlanQuatermain / gist:1063948
Created July 4, 2011 21:08
An example of how to use the prior gist
coverImage = [[KBImageCacheManager sharedManager] cachedImageForImageObject: imageObject type: imageType];
if ( coverImage == nil )
{
MAKE_WEAK_SELF();
_imageObserver = [[imageObject registerImageUpdateObserverUsingBlock: ^(UIImage *image, NSString *imageID, NSString *type) {
USE_WEAK_SELF();
self->_coverImageView.image = image;
[[KBImageCacheManager sharedManager] removeObserver: _imageObserver];
[_imageObserver release]; _imageObserver = nil;
}] retain];
@indragiek
indragiek / NSView-SNRAdditions.m
Created September 11, 2011 03:11
Animated NSView redraws + scrolling
@implementation NSView (SNRAdditions)
- (void)scrollPointAnimated:(NSPoint)point
{
NSScrollView *scrollView = [self enclosingScrollView];
NSClipView *clipView = [scrollView contentView];
NSPoint constrainedPoint = [clipView constrainScrollPoint:point];
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[clipView animator] setBoundsOrigin:constrainedPoint];
[NSAnimationContext endGrouping];
@lilyball
lilyball / gist:1223354
Created September 16, 2011 22:52
DVCS sequence number issues

Sequence numbers in DVCS's have a few problems that don't exist in a centralized VCS like SVN:

  • The sequence numbering will be different in each repo. This makes a sequence number completely meaningless without a context repo
    • Attempting to use a "centralized" repo as the canonical source for sequence numbers is unwieldy, and doesn't even work in any workflow besides hub-and-spokes
      • Any time you have to reference a sequence number, you have to talk to the central repo to figure out what it is. SVN has to talk to its