Skip to content

Instantly share code, notes, and snippets.

@vinhnx
vinhnx / postmodern.md
Last active August 29, 2015 13:57
Postmodern Programming

by Rob Rix | [original source](https://github.com/robrix/Postmodern-Programming/blob/master/Postmodern Programming.md) | better format

Foreword: What’s In a Name?

The schedule calls this talk “Building a Better Mousetrap: Declarative Programming and You.” Mark Dalrymple calls it the same, but with “Moose” instead of “Mouse.” I’ve tried on a few other names for it in the meantime, and am now thinking of it as Postmodern Programming. I hope you’ll forgive the change, but I think this new title more accurately describes its subject.

I’ve gone through many iterations of this material, including a half-written GitHub client which was to be used to inspect its own source code and commits during the talk. I call it Navel-Gazing. We won’t be looking at it today (although it’s on my github page if you’re interested), but I think you’ll find its name appropriate to the talk, too.

As to why “Postmodern Programming” or “Navel-Gazing” or any of this might fit

@interface UIView (MPAdditions)
@end
@implementation UIView (MPAdditions)
- (id)debugQuickLookObject {
if (self.bounds.size.width < 0.0f || self.bounds.size.height < 0.0f) {
return nil;
}
static NSString * BCP47LanguageCodeFromISO681LanguageCode(NSString *ISO681LanguageCode) {
if ([ISO681LanguageCode isEqualToString:@"ar"]) {
return @"ar-SA";
} else if ([ISO681LanguageCode hasPrefix:@"cs"]) {
return @"cs-CZ";
} else if ([ISO681LanguageCode hasPrefix:@"da"]) {
return @"da-DK";
} else if ([ISO681LanguageCode hasPrefix:@"de"]) {
return @"de-DE";
} else if ([ISO681LanguageCode hasPrefix:@"el"]) {
@vinhnx
vinhnx / .gitignore
Created May 7, 2014 13:36 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@vinhnx
vinhnx / xc
Created May 18, 2014 16:43
Open the first Xcode workspace or project found. Put this in your .zshrc file
# thanks https://gist.github.com/subdigital/5420709#comment-864932
function xc {
xcode_proj=`find . -name "*.xc*" -d 1 | sort -r | head -1`
if [[ `echo -n $xcode_proj | wc -m` == 0 ]]
then
echo "No xcworkspace/xcodeproj file found in the current directory."
else
echo "Found $xcode_proj"
@vinhnx
vinhnx / .gitignore
Created May 18, 2014 16:44 — forked from mmorey/.gitignore
.gitignore file for Xcode5
#########################
# .gitignore file for Xcode5
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
# and https://gist.github.com/adamgit/3786883
@vinhnx
vinhnx / gist:2d570cbcc0c8f68b809e
Created May 18, 2014 16:47 — forked from odrobnik/gist:2106f26379fd609d4ed3
Toggle status bar and navigation bar together
- (IBAction)handleTap:(id)sender
{
BOOL isHiding = !_statusBarHidden;
_statusBarHidden = isHiding;
[UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:0 options:0
animations:^{
[self setNeedsStatusBarAppearanceUpdate];
}
completion:NULL];
@vinhnx
vinhnx / readme.md
Created May 18, 2014 17:09 — forked from jonah-williams/readme.md
Default iOS project configuration patterns

iOS Project Template

  1. Install .ruby-version
  2. Install gemfile with pods dependency
  3. Install CocoaPods for dependency management
  4. Install Kiwi pod for unit tests
  5. Install objection pod for IoC
  6. Install KIF pod for acceptance specs
  7. Reorganize file structure; groups match file system folders, split out groups based on features or roles
  8. Define views in nib files by default; designer editable, easier auto-layout configuration, easier localization
@vinhnx
vinhnx / PSPDFUIKitMainThreadGuard.m
Created May 20, 2014 03:26 — forked from steipete/PSPDFUIKitMainThreadGuard.m
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job. You might …
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2013 Peter Steinberger. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.