Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

fengxing annidy

I may be slow to respond.
Block or report user

Report or block annidy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
annidy / gist:10964785
Created Apr 17, 2014
View gist:10964785
#include <dlfcn.h>
typedef CFNotificationCenterRef (*fpCFNotificationCenterRef)(void);
typedef void (*fpCTTelephonyCenterAddObserver)(CFNotificationCenterRef center, const void *observer, CFNotificationCallback callBack, CFStringRef name, const void *object, CFNotificationSuspensionBehavior suspensionBehavior);
void callback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo);
int install_callback()
void *framework = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY);
fpCFNotificationCenterRef CTTelephonyCenterGetDefault = (fpCFNotificationCenterRef)dlsym(framework, "CTTelephonyCenterGetDefault");
if (CTTelephonyCenterGetDefault == NULL) {
annidy / MyIllustrator.rb
Created May 20, 2014
Illustrator Mac 中文版启动修复
View MyIllustrator.rb
APP = "/Applications/Adobe Illustrator CS6/Adobe Illustrator"
if File.size(APP) > 4096
print "Rename"
NEWAPP = File.dirname(APP) + '/AICS6'
`mv "#{APP}" "#{NEWAPP}"`
annidy / pname.rb
Created Jun 11, 2014
View pname.rb
# annidy 2014-6-11
d =".")
max = 0
d.each {|x|
m = /^\d+\./.match(x)
m = m or ["0"]
max = [max, m.to_s.to_i].max
annidy / baseview.m
Created Jun 14, 2014
View baseview.m
- (void)baseView
BOOL hasAlertView = FALSE;
UIView* baseView = [UIApplication sharedApplication].keyWindow;
for (UIWindow* w in [UIApplication sharedApplication].windows) {
for (UIView *o in w.subviews)
[self dismissAlertView:o didDismiss:&hasAlertView];
View NSString_CoreAdditions.m
@implementation NSString (CoreAdditions)
URL encode
- (NSString *)encodeURIComponent_NON_ARC
static NSString * const kLegalCharactersToBeEscaped = @"!*'();:@&=+$,/?%#[]";
return [(NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,
annidy / clicktest
Created Aug 18, 2014
View clicktest
tell application "Finder"
set my_folder_path to container of (path to me) as text
set my_folder_path to POSIX path of my_folder_path
set my_path to my_folder_path & "smv"
end tell
tell application "Google Chrome"
open location ""
end tell
View NSObject+Blocks.h
// NSObject+Blocks.h
// Filemator
// Created by Zachary Waldowski on 4/12/11.
// Copyright 2011 Dizzy Technology. All rights reserved.
@interface NSObject (Blocks)
annidy / gist:7ebd4932dc1f1718ab71
Created Oct 21, 2014
View gist:7ebd4932dc1f1718ab71
int GetSignalStrength()
static int (*CTGetSignalStrength)() = GetSignalStrength;
if (CTGetSignalStrength == GetSignalStrength) {
void *libHandle = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY);
CTGetSignalStrength = dlsym(libHandle, "CTGetSignalStrength");
if( CTGetSignalStrength == NULL) {
View FMDatabase+UserVer.h
#import "FMDatabase.h"
@interface FMDatabase (UserVer)
@property (nonatomic) int userVer;
View NSData+OADataHelpers.m
#import "NSData+OADataHelpers.h"
@implementation NSData (OADataHelpers)
- (NSString*) UTF8String
// First we try strict decoding to avoid iconv overhead when not needed (majority of cases).
NSString* str = [[[NSString alloc] initWithData:self encoding:NSUTF8StringEncoding] autorelease];
if (!str)
You can’t perform that action at this time.