Skip to content

Instantly share code, notes, and snippets.

View erikaderstedt's full-sized avatar

Erik Aderstedt erikaderstedt

View GitHub Profile
@mattt
mattt / NSDecimalNumber.swift
Last active April 1, 2023 00:06
NSDecimalNumber Additions for Swift
import Foundation
// MARK: - Comparable
extension NSDecimalNumber: Comparable {}
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool {
return lhs.compare(rhs) == .OrderedSame
}
@bmatcuk
bmatcuk / symbolizing_osx_crash_logs.md
Created May 29, 2014 21:43
How to symbolize OSX crash logs

How to Symbolize OSX Crash Logs

Unfortunately, xcode does not yet have support for importing OSX crash logs and symbolizing them. Therefore, you must use the command line and a little bit of manual work.

  1. Find your dSYM file.
    1. Assuming you are using xcode's archive functionality, open the Organizer window from the Window menu.
    2. Click the Archives tab.
    3. Right click on the appropriate build and select Show in Finder.
    4. When Finder opens, right click on the selected archive and select Show Package Contents.
    5. Navigate to the dSYM directory and copy the appropriate dSYM file to a temporary directory.
  2. Then navigate to Products, then Applications, and copy the app file to the same temporary directory.
@patrickhammond
patrickhammond / android_instructions.md
Last active March 29, 2024 20:14
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@beccadax
beccadax / IndexSetEnumeration.m
Last active December 17, 2015 08:48
This gist includes a quick syntax for constructing NSIndexSets—[@0:9] and [@0:9 step:2]—and fast enumeration support for NSIndexSet (yielding NSNumbers). The result is that you can enumerate over ranges using for/in. The gist is CodeRunner ready.
#import <Foundation/Foundation.h>
@interface NSNumber (range)
- (NSIndexSet*):(NSUInteger)max;
- (NSIndexSet*):(NSUInteger)max step:(NSUInteger)step;
@end
void __AllowOnceEvery(double seconds, void (^block)(void), NSTimeInterval * lastTime)
{
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
if (now - *lastTime > seconds) {
*lastTime = now;
block();
}
}
@rentzsch
rentzsch / gist:1216022
Created September 14, 2011 07:14
NSString* JRNSStringFromCATransform3D(CATransform3D transform)
static NSString* prettyFloat(CGFloat f) {
if (f == 0) {
return @"0";
} else if (f == 1) {
return @"1";
} else {
return [NSString stringWithFormat:@"%.3f", f];
}
}