Skip to content

Instantly share code, notes, and snippets.

View psandeepunni's full-sized avatar

Sandeep Unni psandeepunni

View GitHub Profile
@psandeepunni
psandeepunni / DeviceUID.m
Created January 14, 2016 18:44 — forked from miguelcma/DeviceUID.m
iOS Unique Device ID that persists between app reinstalls
/* DeviceUID.h
#import <Foundation/Foundation.h>
@interface DeviceUID : NSObject
+ (NSString *)uid;
@end
*/
// Device.m
@psandeepunni
psandeepunni / flatten.js
Last active November 18, 2021 22:08
Javascript function to flatten a nested Associative Array (tree) to a List
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;
}