This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"html/template" | |
"github.com/gorilla/sessions" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension String { | |
func replaceUnicodeChars () -> String { | |
if self.rangeOfString("\\u") != nil { | |
let pattern = "u([A-F0-9]{4})" | |
do { | |
let regex = try NSRegularExpression(pattern: pattern, options: .DotMatchesLineSeparators) | |
let tmp = self as NSString | |
var results = [String]() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* DeviceUID.h | |
#import <Foundation/Foundation.h> | |
@interface DeviceUID : NSObject | |
+ (NSString *)uid; | |
@end | |
*/ | |
// Device.m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** | |
* This mongoose query caching is a shameless copy of mongoose-memcached (https://github.com/benjibc/mongoose-memcached) module | |
* But instead of relying upon using memcached db, this uses an in memory cache provided by memory-cache (https://github.com/ptarjan/node-cache) | |
* Thank you Paul Tarjan (ptarjan) and Yufei (Benny) Chen (benjibc). You've made our lives easier | |
*/ | |
/* | |
*Module dependencies. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bfs = function(tree, key, collection) { | |
if (!tree[key] || tree[key].length === 0) return; | |
for (var i=0; i < tree[key].length; i++) { | |
var child = tree[key][i] | |
collection[child.id] = child; | |
bfs(child, key, collection); | |
} | |
return; | |
} |