Skip to content

Instantly share code, notes, and snippets.

View Ben-G's full-sized avatar
💭
💻

Benjamin Encz Ben-G

💭
💻
View GitHub Profile
@MarcoSero
MarcoSero / gist:5787782
Created June 15, 2013 11:15
Class Dump iOS 7 Frameworks
# install class-dump
brew install class-dump
# dump the frameworks you're interested in
class-dump -H -o UIKit /Applications/Xcode5-DP.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework
class-dump -H -o SpringBoardUI /Applications/Xcode5-DP.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/PrivateFrameworks/SpringBoardUI.framework
# The Script
```sh
git log v2.1.0...v2.1.1 --pretty=format:'<li> <a href="http://github.com/jerel/<project>/commit/%H">view commit &bull;</a> %s</li> ' --reverse | grep "#changelog"
```
# A git alias for the command:
@MartinMoizard
MartinMoizard / gist:6537467
Created September 12, 2013 13:37
Category on UIViewController: recursive function to present a modal View Controller anywhere in the application. Example: [self.window.rootViewController presentViewControllerFromVisibleViewController:myViewController]; Works with application using only UINavigationController and modal views. Can be enhanced to handle UITabBarController or other…
- (void)presentViewControllerFromVisibleViewController:(UIViewController *)viewControllerToPresent
{
if ([self isKindOfClass:[UINavigationController class]]) {
UINavigationController *navController = (UINavigationController *)self;
[navController.topViewController presentViewControllerFromVisibleViewController:viewControllerToPresent];
} else if (self.presentedViewController) {
[self.presentedViewController presentViewControllerFromVisibleViewController:viewControllerToPresent];
} else {
[self presentModalViewController:viewControllerToPresent animated:YES];
}
@liu7yong
liu7yong / unpack_plist.py
Last active April 3, 2019 02:00 — forked from wonkwh/unpack_plist.py
extract image from plist,png file created by texturepacker
#/usr/local/bin/python
import os,sys
from xml.etree import ElementTree
from PIL import Image
def tree_to_dict(tree):
d = {}
for index, item in enumerate(tree):
if item.tag == 'key':
if tree[index+1].tag == 'string':
@floriankugler
floriankugler / gist:6870499
Last active September 29, 2023 15:56
Mapping of NSURLConnection to NSURLSession delegate methods. Created by Mattt Thompson.
NSURLConnection | NSURLSession
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connectionShouldUseCredentialStorage: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler:
| N
@JaviSoto
JaviSoto / gist:6926083
Last active April 22, 2025 09:09
Rotation transformation with anchor point
- (void)rotateView:(UIView *)view
byRadianDegrees:(CGFloat)radianDegrees
withAnchorPoint:(CGPoint)relativeAnchorPoint
{
const CGRect viewBounds = view.bounds;
const CGPoint anchorPoint = CGPointMake(viewBounds.size.width * relativeAnchorPoint.x, viewBounds.size.height * relativeAnchorPoint.y);
CGAffineTransform transform = CGAffineTransformIdentity;
transform = CGAffineTransformTranslate(transform, anchorPoint.x, anchorPoint.y);
transform = CGAffineTransformRotate(transform, radianDegrees);
diff --git a/protobuf-2.5.0/src/google/protobuf/stubs/once.cc b/protobuf-2.5.0/src/google/protobuf/stubs/once.cc
index 1e24b85..e9056ac 100644
--- a/protobuf-2.5.0/src/google/protobuf/stubs/once.cc
+++ b/protobuf-2.5.0/src/google/protobuf/stubs/once.cc
@@ -63,7 +63,7 @@ void SchedYield() {
} // namespace
void GoogleOnceInitImpl(ProtobufOnceType* once, Closure* closure) {
- internal::AtomicWord state = internal::Acquire_Load(once);
+ internal::AtomicWord state = internal::Acquire_Load((volatile internal::Atomic32 *)once);
@armadsen
armadsen / MultipleClassExtensions.m
Last active January 4, 2016 11:59
Demonstration of multiple class extensions in Objective-C. For http://stackoverflow.com/a/21343983/344733
#import <Foundation/Foundation.h>
@interface TestClass : NSObject
@end
@interface TestClass ()
@property NSString *name;
@jquave
jquave / jamesonquave.com comment reply
Created June 3, 2014 01:05
jamesonquave.com comment reply
import UIKit
class AnotherClass {
var someVar = 1
let someConst = 2
func somePrivateFunc() -> Bool {
return true
}
@correia
correia / swift-kvo-example.swift
Last active April 16, 2023 02:38
A quick example for how to use Foundation style KVO from Swift. (Official documentation from Apple is forthcoming.)
//
// Swift-KVO
//
// Created by Jim Correia on 6/5/14.
// Copyright (c) 2014-2015 Jim Correia. All rights reserved.
//
// Update: 6/17/2014
//
// KVOContext has gone away; use the same idiom you'd use from Objective-C for the context
//