Skip to content

Instantly share code, notes, and snippets.

//
// EGOTitledTableViewCell.h
// EGOClasses
//
// Created by Shaun Harrison on 6/2/09.
// Copyright 2009 enormego. All rights reserved.
//
#import <UIKit/UIKit.h>
#!/usr/bin/env ruby -w
#
# This is a script to help view a patch file in the Changes.app[1] UI. It is
# pretty basic, but does the job. It simply creates 2 copies of the file,
# where in one (the "original") it strips all the lines starting with '+', and
# the other (the "modified") it strips all the lines starting with '-'. It
# also removes the first character of all lines starting with a space, +, or -
# Then it simply uses the chdiff command line too to view the differences.
#
# It takes input either from filename arguments (multiple files are ok, but it
@jk
jk / check-php-syntax-errors.sh
Created July 13, 2011 15:50
Check directories for PHP syntax errors
find . -name "*.php" -exec php -l {} \; | grep "PHP Parse error:"
@jk
jk / php_isReallyAnInt.php
Created July 18, 2011 12:56
Go straight to hell with the PHP type system
<?php
function isReallyAnInt($obj)
{
if (!is_numeric($obj))
return false;
if (intval($obj) != floatval($obj))
return false;
return true;
@jk
jk / PHP+RestServer.language
Created August 16, 2011 13:34
Extended TextMate PHP language for supporting RestServer.php notation
{ scopeName = 'source.php';
comment = "TODO:
• Try to improve parameters list syntax – scope numbers, ‘=’, ‘,’ and possibly be intelligent about entity ordering
• Is meta.function-call the correct scope? I've added it to my theme but by default it's not highlighted";
firstLineMatch = '^#!.*(?<!-)php[0-9]{0,1}\b';
foldingStartMarker = '(/\*|\{\s*$|<<<HTML)';
foldingStopMarker = '(\*/|^\s*\}|^HTML;)';
patterns = (
{ comment = 'Matches empty tags.';
match = '(?x)
@jk
jk / IBAForms.podspec
Created November 29, 2011 08:57
Podspec for IBAForms
Pod::Spec.new do |s|
s.summary = 'A simple iPhone forms library'
s.license = 'Apache License, Version 2.0'
s.source = { :git => 'https://github.com/ittybittydude/IBAForms.git', :tag => '1.0.0' }
s.source_files = 'library/**/*.{h,m}'
s.author = { 'Itty Bitty Apps' => '[email protected]' }
s.version = '1.0.0'
s.homepage = 'https://github.com/ittybittydude/IBAForms'
s.name = 'IBAForms'
s.platform = :ios
@jk
jk / ch_returncode.h
Created December 16, 2011 09:22
Completion handler return code snippet
enum ClassNameResult {
ClassNameResultAborted,
ClassNameResultSuccessful,
ClassNameResult…
};
typedef enum ClassNameResult ClassNameResult;
@jk
jk / objc_api_visibility.pl
Created December 26, 2011 17:26
iOS AppStore private API usage checker
#!/usr/bin/env perl
# objc_api_visibility.pl
# by Ryan Petrich, inspired by Dustin Howett's Logos
# Reads all Objective-C method names from an installed SDK, determines their visibility and optionally compares against an iOS app binary
sub read_methods {
my $cmd = shift;
my $when_found = shift;
my $current_class;
open(LS_CMD, "$cmd |") or die "Can't run '$cmd'\n$!\n";
@jk
jk / crashQueue.m
Created January 10, 2012 10:27
ARC GCD Crash
-(void)crashQueue {
dispatch_queue_t webviewQueue = dispatch_queue_create("de.company.myCrashQueue", DISPATCH_QUEUE_SERIAL);
_webviewQueueValid = YES;
// NSLog(self.company);
dispatch_async(webviewQueue, ^{
if (_webviewQueueValid) {
NSURL *companyURL = [NSURL URLWithString:[companyURI stringByAppendingFormat:@"%@.html", self.company.pathName]];
NSMutableURLRequest *requestCompany = [NSMutableURLRequest requestWithURL:companyURL];
[self.companyWebView loadRequest:requestCompany];
@jk
jk / fading_gradient.m
Created May 4, 2012 11:44
UIScrollView fading gradient
- (void)maskUIViewHorizontally:(UIView *)view {
view.layer.mask = nil;
_maskLayer = nil;
if (!_maskLayer) {
_maskLayer = [CAGradientLayer layer];
UIColor *outerColor = [UIColor colorWithWhite:1.0 alpha:0.0]; // transparent
UIColor *innerColor = [UIColor colorWithWhite:1.0 alpha:1.0]; // opaque