Skip to content

Instantly share code, notes, and snippets.

println("Y: note \(self.note?.uuid) has changes? \(self.note?.hasChanges)") // Y: note AE69CE67-6AD8-45ED-A81C-327A255B8AFD has changes? false
if self.note?.hasChanges {
println("Z: note \(self.note?.uuid) has changes? \(self.note?.hasChanges)") // Z: note AE69CE67-6AD8-45ED-A81C-327A255B8AFD has changes? false
println("deleting note!") // deleting note!
self.note?.deleteEntity()
}
func split<T>(inout lhs: Array<T>, rhs: Array<T>) {
for removingItem: T in rhs {
var index: Int = 0
for item: T in lhs {
if removingItem === item { // Could not find overload for '===' that accepts the supplied arguments
lhs.removeAtIndex(index)
}
index++
}
}
while :; do curl --data "api_token=<your_api_token>" http://api.justyo.co/yoall/; done
socket.on('location', function (data) {
socket.broadcast.emit('update', (socket['id'] + ':' + data));
});
socket.on('disconnect', function () {
socket.broadcast.emit('disappear', socket['id']);
console.log(socket['id'] + ' has disconnected!');
});
io.on('connection', function (socket) {
socket.broadcast.emit('join', socket['id']);
console.log(socket['id'] + ' has connected!');
});
io.on('connection', function (socket) {
});
var io = require('socket.io')(3000);
{
"name": "WorldPinServer",
"version": "0.0.0",
"description": "Server to distributed phone locations to other phones",
"main": "app.js",
"author": "myself",
"dependencies": {
"socket.io":"1.0.4"
}
}
@pcperini
pcperini / gist:5d54c823f835f7dd856b
Last active August 29, 2015 14:02
WorldPin Socket Events
[self.socket on: @"update" callback: ^(SIOParameterArray *args)
{
// pinData == @"pinID:lat,long"
// self.pins == @{@"pinID": <WPAnnotation @ (lat, long)>}
NSString *pinData = [args firstObject];
NSArray *dataPieces = [pinData componentsSeparatedByString: @":"];
NSString *pinID = [dataPieces firstObject];
@pcperini
pcperini / gist:9e8535811117ee420883
Last active August 29, 2015 14:02
WorldPin Socket Events
- (void)viewDidLoad
{
[super viewDidLoad];
[SIOSocket socketWithHost: @"http://yourHost:3000" response: ^(SIOSocket *socket)
{
self.socket = socket;
__weak typeof(self) weakSelf = self;
self.socket.onConnect = ^()