Skip to content

Instantly share code, notes, and snippets.

#########################
# .gitignore file for Xcode5
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
# and https://gist.github.com/adamgit/3786883
@phnessu4
phnessu4 / GTMBase64.h
Last active August 29, 2015 13:56
Base64
//
// GTMBase64.h
//
// Copyright 2006-2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
@phnessu4
phnessu4 / DeviceIdentifier.h
Created February 18, 2014 04:29
获取mac地址, 系统唯一标示
#import <Foundation/Foundation.h>
@interface DeviceIdentifier : NSObject
/**
* @brief use this method when you need a unique identifier in one app.
* It generates a hash from the MAC-address in combination with the bundle identifier of your app.
*
#import <Foundation/Foundation.h>
@interface MD5 : NSObject
/**
* @brief calculate a message-digest fingerprint for a input string.
*
* @return return a message-digest fingerprint
*/
+ (NSString *)MD5String:(NSString *)string;
@phnessu4
phnessu4 / gist:8998813
Created February 14, 2014 10:18
字节序转换
#include <CFByteOrder.h>
// Bytes to uint32_t
NSData *data = <THE_DATA>;
void *bytes = [data bytes];
uint32_t *intBytes = (NSInteger*)bytes;
uint32_t swapped = CFSwapInt32BigToHost(*intBytes); ///< If the data in `data' is big endian
// uint32_t to bytes
uint32_t someInt = 1234;
#pragma mark - NSURLConnection methods
/*
- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection {
return NO;
}
*/
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
//NSLog(@"can auth");
//尚译bookmarklet 压缩
javascript:void((function(){if(window.Como&&window.Como.someyi){Como.someyi.open()}else{var%20a=document.createElement('script');a.setAttribute('type','text/javascript');var%20b=document.charset?document.charset:document.characterSet;var%20c=b.toLowerCase()=='gb2312'?'pack-gb2312.js':'pack-utf8.js';a.setAttribute('src','http://bcs.duapp.com/shangyi12345/'+c);document.getElementsByTagName('head').item(0).appendChild(a);Text.prototype.tagName='#text'}})())
//尚译bookmarklet 未压缩
javascript: void((function () {
if (window.Como && window.Como.someyi) {
Como.someyi.open()
} else {
var a = document.createElement('script');
a.setAttribute('type', 'text/javascript');
@phnessu4
phnessu4 / demon.php
Created September 13, 2013 03:40
php守护进程
<?php
define("THREADS",1);
define("DAEMON","/usr/local/bin/daemon");
define("SCRIPT","/****/worker.php");
define("CHDIR","/****/");
define("NAME_PREFIX","worker");
define("PHP_CLI","/usr/local/php/bin/php");
@phnessu4
phnessu4 / git
Created August 23, 2013 08:08
git 的一些操作
#删除git submodule
git rm --cached /path/to/source
@phnessu4
phnessu4 / mongo.php
Last active July 5, 2016 11:56
mongodb php类
/**
* @doc http://fuelphp.com/docs/classes/mongo/methods.html
* has changed by remove profiling setting
*
* sample config
* 'mongodb' => array(
* 'hostname' => 'localhost',
* 'database' => 'database',
* 'username' => 'admin',
* 'password' => 'admin',