Skip to content

Instantly share code, notes, and snippets.

View nst's full-sized avatar

Nicolas Seriot nst

View GitHub Profile
@jbafford
jbafford / gist:d91ac15cf79a22e70f65
Created August 4, 2014 21:03
List OSX codesign versions for installed apps
find /Applications ~/Applications -maxdepth 3 -name "*.app" | while read a ; do echo; echo -n "$a ___ "; codesign -vd "${a}" 2>&1 | awk '/version/ {print $3}'; done | awk -F'___' '{print $2 " " $1}' | sort -u
@kongtomorrow
kongtomorrow / gist:80ff47743d2c63355c42
Last active August 29, 2015 14:09
Swift + Unicode evilness :-D
let é = "precomposed character!"
let é = "decomposed characters!"
println(é) // prints "precomposed character!"
println(é) // prints "decomposed characters!"
#!/usr/bin/env python
# Nicolas Seriot
# 2011-01-06
# https://gist.github.com/768457
"""
Input: path of an Objective-C project
Output: import dependancies Graphviz format
@landonf
landonf / deadlock.m
Created June 4, 2011 04:02
Deadlocking a signal handler by using ObjC (ARM / x86-32)
#import <Foundation/Foundation.h>
static void unsafe_signal_handler (int signo) {
signal(signo, SIG_DFL);
/* Attempt to use ObjC to fetch the backtrace. Will trigger deadlock. */
[NSThread callStackSymbols];
}
int main(int argc, char *argv[]) {
@mbinna
mbinna / UIViewController+MBSensitiveInformationInScreenshotPrevention.h
Created June 12, 2011 13:00
Prevent sensitive information from appearing in the screenshot that is automatically taken when the application transitions from the foreground to the background and vice-versa.
//
// UIViewController+MBSensitiveInformationInScreenshotPrevention.h
//
// Created by Manuel Binna on 05.05.11.
// Copyright 2011 Manuel Binna. All rights reserved.
//
@interface UIViewController (MBSensitiveInformationInScreenshotPrevention)
@iamleeg
iamleeg / pileOfPoo.m
Created March 22, 2012 01:51
The pile of poo Objective-C method
#import <Foundation/Foundation.h>
@interface A: NSObject
@end
@implementation A
void pileOfPoo(id self, SEL _cmd) {
NSLog(@"💩");
}
@Machx
Machx / results.txt
Created March 30, 2012 16:43
Test isEqual & isEqualToString
tail end of the results
2012-03-30 11:36:39.865 Untitled[78506:707] IsEqual: 1438 | isEqualToString 589
2012-03-30 11:36:39.875 Untitled[78506:707] IsEqual: 1377 | isEqualToString 590
2012-03-30 11:36:39.876 Untitled[78506:707] IsEqual: 956 | isEqualToString 560
2012-03-30 11:36:39.877 Untitled[78506:707] IsEqual: 860 | isEqualToString 451
2012-03-30 11:36:39.877 Untitled[78506:707] IsEqual: 824 | isEqualToString 433
2012-03-30 11:36:39.878 Untitled[78506:707] IsEqual Average 1212 - IsEqualToString Average 619
@jjgod
jjgod / cascadelist.m
Created April 19, 2012 08:32
Use cascade list attribute to customize font fallback in Core Text
#import <ApplicationServices/ApplicationServices.h>
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
{
if (argc != 2)
return 0;
NSAutoreleasePool *pool = [NSAutoreleasePool new];
CFStringRef name = (CFStringRef) [NSString stringWithUTF8String: argv[1]];
@sburlot
sburlot / gist:3046784
Created July 4, 2012 11:08
How the get the 512x512 icon for any iPhone app.
How the get the 512x512 icon for an app.
Look for this app on the itunes.apple.com website (Google is your friend)
For example, this excellent app.
http://itunes.apple.com/au/app/bancomap/id309009025?mt=8
Look for the URL of the icon in the page (it's a 175x175 picture).
I use Safari, so right click on the icon and choose "Inspect Element"
@baz
baz / gist:3073573
Created July 9, 2012 00:38
PPI of iOS device
float screenResolution() {
struct utsname systemInfo;
uname(&systemInfo);
char *name = systemInfo.machine;
float ppi;
if ((strstr(name, "iPod") != NULL) && (strstr(name, "iPod4") == NULL)) {
// older ipod touches
ppi = 163;
} else if ((strstr(name, "iPhone") != NULL) && (strstr(name, "iPhone3") == NULL)) {