Skip to content

Instantly share code, notes, and snippets.

#pragma mark - 新浪微博mid与url互转
-(NSArray*)str62keys
{
return @[@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",
@"a",@"b",@"c",@"d",@"e",@"f",@"g",@"h",@"i",@"j",@"k",@"l",@"m",@"n",@"o",@"p",@"q",@"r",@"s",@"t",@"u",@"v",@"w",@"x",@"y",@"z",
@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X",@"Y",@"Z"];
}
/**
* 62进制值转换为10进制
* @param {NSString} str62 62进制值
@onlyyoujack
onlyyoujack / command
Created November 20, 2013 03:35
command
1.To find which library is using uniqueidentifier method, go to your project folder and type in:
$ find . | grep -v .svn | grep "\.a" | grep -v "\.app" | xargs grep uniqueIdentifier
function doesAppExist() {
// try to open iOS application
document.location = 'customiosappurl://';
// if above failed, nothing happened
// set a timeout and do something else
!window.document.webkitHidden && setTimeout(function() {
setTimeout(function() {
window.location = '//apple.itunes.com/whatever'
}, 100);
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!-- iframe used for attempting to load a custom protocol -->
<iframe style="display:none" height="0" width="0" id="loader"></iframe>
Pod::Spec.new do |s|
s.name = 'ShareKit'
s.version = '2.0'
s.summary = 'In order to make it easier for new users to choose a canonical fork of ShareKit, the ShareKit community has decided to band together and take responsibility for collecting useful commits into what we're calling "ShareKit 2". It is now ready for you. It is the first officially stable version of ShareKit since February 2010, with more frequent updates expected.'
s.homepage = 'https://github.com/ShareKit/ShareKit'
s.author = 'ShareKit'
s.source = { :git => 'https://github.com/onlyyoujack/ShareKit.git', :tag => 'v2.0' }
s.source_files = 'ShareKit/Classes/ShareKit'
end
@onlyyoujack
onlyyoujack / gist:4601546
Created January 23, 2013 03:11
UIButton remove all target-actions
Call removeTarget:action:forControlEvents: pass nil for the target, NULL for action, and use a control mask that sets all bits (UIControlEventAllEvents). Something like this:
[someControl removeTarget:nil
action:NULL
forControlEvents:UIControlEventAllEvents];
https://developer.apple.com/library/ios/#documentation/uikit/reference/UIControl_Class/Reference/Reference.html
http://stackoverflow.com/questions/3340825/uibutton-remove-all-target-actions
require 'rubygems'
require 'oauth'
require 'yaml'
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
def get_access_token
p "get_access_token: Initializing Consumer"
consumer = OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET, {
OLD:
FMDatabase *db = [FMDatabase databaseWithPath:dbPath];
[db executeUpdate:@"insert into namedparamtest values (:a, :b, :c, :d)" withParameterDictionary:dictionaryArgs];
NEW:
FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:dbPath];
[queue inDatabase:^(FMDatabase *db) {
@onlyyoujack
onlyyoujack / gist:2383840
Created April 14, 2012 11:50 — forked from asmallteapot/gist:1664575
Using C99 for clever and non-fragile UITableView configuration. Allows implicit defaults. Copypasta’d from a screencap tweeted by @jonsterling: http://twitpic.com/80uyfp
typedef enum {
kAccomplishmentTitleSection = 0,
kAccomplishmentCategorySection,
kNumberOfSections
} NESTemplateEditTableSections;
static NSString * const kCellIdentifiers[] = {
[kAccomplishmentTitleSection] = @"AccomplishmentTitleCell",
[kAccomplishmentCategorySection] = @"AccomplishmentCategoryCell"
};
@onlyyoujack
onlyyoujack / BNRTimeBlock.h
Created April 14, 2012 11:31 — forked from bignerdranch/BNRTimeBlock.h
Timing Utility Post 20120308
CGFloat BNRTimeBlock (void (^block)(void));