Skip to content

Instantly share code, notes, and snippets.

View triplef's full-sized avatar

Frederik Seiffert triplef

View GitHub Profile
@lukaskubanek
lukaskubanek / Bundle+TestFlight.swift
Last active April 17, 2024 18:14
A code snippet for detecting the TestFlight environment for a macOS app at runtime
/// MIT License
///
/// Copyright (c) 2021 Lukas Kubanek, Structured Path GmbH
///
/// 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
/// furnished to do so, subject to the following conditions:
@Ricket
Ricket / gist:78bcd681db86bcbb134558428c4c6cb4
Created September 25, 2018 16:54
git diff -- use jq to pretty-print the json before diffing it
echo "*.json diff=json" >> ~/.gitattributes
git config --global core.attributesfile ~/.gitattributes
git config --global diff.json.textconv "jq '.' \$1"
@aufflick
aufflick / symbolicate_activity_monitor_sample.pl
Created February 11, 2015 09:20
Script to symbolicate output from Activity Monitor.app's sample dumps
#!/usr/bin/perl -w
use strict;
use warnings;
# The human has to determine the UUID from the binary images section for now. Sue me.
my ($uuid, $sample_file_path) = @ARGV;
die "Usage:\n $0 'main bundle uuid' 'path to sample.txt'"
unless $uuid && -f $sample_file_path;
@prendio2
prendio2 / SUPTableViewController.m
Created March 26, 2014 15:05
Custom viewWillApear to restore selected row when transition is cancelled
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow];
if (selectedRowIndexPath) {
[self.tableView deselectRowAtIndexPath:selectedRowIndexPath animated:YES];
[[self transitionCoordinator] notifyWhenInteractionEndsUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if ([context isCancelled]) {
[self.tableView selectRowAtIndexPath:selectedRowIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
@steipete
steipete / gist:3933090
Created October 22, 2012 18:13
Simple main thread usage detector that I'm using in PSPDFKit to find performance problems early on.
// Smart little helper to find main thread hangs. Enable in appDidFinishLaunching.
// Only available with source code in DEBUG mode.
@interface PSPDFHangDetector : NSObject
+ (void)startHangDetector;
@end
@implementation PSPDFHangDetector
+ (void)startHangDetector {
#ifdef DEBUG
@yamaya
yamaya / xcode-clang-vers
Last active April 3, 2024 02:28
Xcode clang version record
# Xcode 4.3.3
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
# Xcode 4.3.2
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
@paulirish
paulirish / 0readme.md
Created August 22, 2011 05:26
For converting adium logs to decently sexy HTML

adium log export to HTML

this shit is for exporting this weirdass xml out into some sane HTML.

  • run rename.sh to kill the whitespaces in your xml filenames
    • alternatively fix my htmlify.sh to not break on whitespace'd filenames
      • UPDATE: check this comment on a quick fix to avoid this rename script. BOOM! thx @kwef!
  • run htmlify.sh
    • htmlify has a hardcoded destination directory.
  • htmlify also expects the format-html.* files to be up one folder from it.

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";