Skip to content

Instantly share code, notes, and snippets.

View lyonanderson's full-sized avatar

Christopher Lyon Anderson lyonanderson

View GitHub Profile
@0xced
0xced / unprefixed_classes.py
Created July 10, 2012 14:16
List all unprefixed Objective-C classes for a given SDK
#!/usr/bin/env python
import argparse, os, re, subprocess
parser = argparse.ArgumentParser()
parser.add_argument('--sdk', default='', help='OS X or iOS SDK directory')
parser.add_argument('--no-frameworks', action='store_true', default=False, help='do not print frameworks, only unprefixed classes')
args = parser.parse_args()
print_frameworks = not args.no_frameworks
//
// SGDeviceIdentifier.h
// Elements
//
// Created by Justin Williams on 9/28/12.
// Copyright (c) 2012 Second Gear. All rights reserved.
//
#import <Foundation/Foundation.h>
@jamztang
jamztang / LICENSE
Last active November 2, 2019 22:33
UINibDecoderProxy - Use NSProxy to observe what's encoded when views and controllers are created in Interface Builder.
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
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:
The above copyright notice and this permission notice shall be included in all
@radianttap
radianttap / gist:4484269
Last active December 10, 2015 19:48 — forked from anonymous/gist:4468522
Pulse view
+ (void)pulseView:(UIView *)view completion:(void (^)(void))block {
// if you use auto layout, view-based transform go haywire, as they trigger layoutSubviews
// consequence is that you have no idea where the view will end up on the screen once animation completes
// see this discussion: http://stackoverflow.com/questions/12943107/how-do-i-adjust-the-anchor-point-of-a-calayer-when-auto-layout-is-being-used
// thus (per solution 4 from link above), rewriting with CAKeyframeAnimation
CAKeyframeAnimation *ka = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
ka.duration = .49;
@mklooss
mklooss / Product.php
Last active December 11, 2015 00:29
Magento Product Cache Loading by Johann Reinke, added "isAdmin" http://www.johannreinke.com/en/2012/04/13/magento-how-to-cache-product-loading/
<?php
/**
* @see http://www.johannreinke.com/en/2012/04/13/magento-how-to-cache-product-loading/
*/
class Namespace_Catalog_Model_Product
extends Mage_Catalog_Model_Product
{
public function load($id, $field = null)
@drance
drance / gist:4546014
Created January 16, 2013 09:57
Workaround to vanilla UICollectionView+UICollectionViewFlowLayout using non-integral origins, leading to blurry cells.
@implementation BHSCollectionViewFlowLayout
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
NSArray *allAttrs = [super layoutAttributesForElementsInRect:rect];
for (UICollectionViewLayoutAttributes *attributes in allAttrs) {
attributes.frame = CGRectIntegral(attributes.frame);
}
return allAttrs;
}
@markd2
markd2 / array.m
Created February 21, 2013 14:53
On-demand Objective-C message tracing
#import <Foundation/Foundation.h>
// clang -g -fobjc-arc -framework Foundation -o array array.m
void observeObject (id objectToWatch) {
// Just a stub to give DTrace something to hook in to.
}
int main (void) {
@autoreleasepool {
@omz
omz / Evernote Installer.py
Created February 27, 2013 15:07
Evernote Installer
# Simple installer script for using the Evernote SDK in Pythonista
#
# This script should be run from the root directory. In order to keep things
# tidy, it installs the module and all its dependencies in a directory named
# 'evernote-sdk'. In order to be able to import it, you have to add that to
# your import path, like this:
#
# import sys
# sys.path.append('evernote-sdk')
#
@gumob
gumob / thread-safe-libxml2-iOS
Created March 3, 2013 01:37
Compile thread safe libxml2 for iOS
#!/bin/bash
# Referenced from
# http://coin-c.tumblr.com/post/18063869172/thread-safe-xmllib2
# http://pastie.org/3429938
mkdir -p `pwd`/build
OUTDIR="./build"
IOS_BASE_SDK="5.0"
@0xced
0xced / NSObject+Subclasses.h
Last active September 4, 2017 06:37
NSObject category to get subclasses
#import <Foundation/Foundation.h>
@interface NSObject (Subclasses)
+ (NSSet *) subclasses_xcd;
@end