This file contains 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
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() | |
} |
This file contains 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
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++ | |
} | |
} |
This file contains 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
while :; do curl --data "api_token=<your_api_token>" http://api.justyo.co/yoall/; done |
This file contains 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
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!'); | |
}); |
This file contains 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
io.on('connection', function (socket) { | |
socket.broadcast.emit('join', socket['id']); | |
console.log(socket['id'] + ' has connected!'); | |
}); |
This file contains 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
io.on('connection', function (socket) { | |
}); |
This file contains 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 io = require('socket.io')(3000); |
This file contains 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
{ | |
"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" | |
} | |
} |
This file contains 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
[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]; | |
This file contains 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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[SIOSocket socketWithHost: @"http://yourHost:3000" response: ^(SIOSocket *socket) | |
{ | |
self.socket = socket; | |
__weak typeof(self) weakSelf = self; | |
self.socket.onConnect = ^() |