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
#!/usr/bin/env xcrun swift | |
// | |
// res.swift | |
// | |
// | |
// Created by John Liu on 2014/10/02. | |
//0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret ./scres.swift -target x86_64-apple-darwin13.4.0 -target-cpu core2 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -color-diagnostics -module-name scres -- -s 0 1440 | |
// |
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
import HTTPServer | |
import Router | |
import JSON | |
import JSONMediaType | |
import MediaType | |
import ContentNegotiationMiddleware | |
import Mapper | |
import StructuredData |
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
import HTTPServer | |
import Router | |
import JSON | |
func getIdParameter(from request: Request) -> Int { | |
guard let idString = request.pathParameters["id"] else { return 0 } | |
return Int(idString) ?? 0 | |
} | |
let router = Router { route in |
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
import C7 | |
import Venice | |
import TCP | |
public enum PoolError : ErrorProtocol { | |
case tooBusy, empty, timeout, maxErrorDurationExeceeded, maxWaitDurationExceeded, maxUnavailableDurationExceeded | |
} | |
protocol Pool { |
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
Scotts-MacBook-Pro:Zewo scottbyrns$ sudo zewodev init | |
/Library/Ruby/Gems/2.0.0/gems/zewo-dev-0.2.9/lib/zewo.rb:255: warning: assigned but unused variable - name | |
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55: warning: loading in progress, circular require considered harmful - /Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/ansi.rb | |
from /usr/local/bin/zewodev:23:in `<main>' | |
from /usr/local/bin/zewodev:23:in `load' | |
from /Library/Ruby/Gems/2.0.0/gems/zewo-dev-0.2.9/bin/zewodev:3:in `<top (required)>' | |
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' | |
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' | |
from /Library/Ruby/Gems/2.0.0/gems/zewo-dev-0.2.9/lib/zewo.rb:10:in `<top (required)>' | |
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ |
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
static func toUInt32Array(slice: ArraySlice<UInt8>) -> Array<UInt32> { | |
var result = Array<UInt32>() | |
result.reserveCapacity(16) | |
for idx in slice.startIndex.stride(to: slice.endIndex, by: sizeof(UInt32)) { | |
let val1:UInt32 = (UInt32(slice[idx.advanced(by: 3)]) << 24) | |
let val2:UInt32 = (UInt32(slice[idx.advanced(by: 2)]) << 16) | |
let val3:UInt32 = (UInt32(slice[idx.advanced(by: 1)]) << 8) | |
let val4:UInt32 = UInt32(slice[idx]) | |
let val:UInt32 = val1 | val2 | val3 | val4 |
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
package org.apache.cordova.plugin; | |
import org.apache.cordova.api.CordovaPlugin; | |
import org.apache.cordova.api.PluginResult; | |
import org.json.JSONArray; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
/** | |
* This class echoes a string called from JavaScript. |
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
public void sendMessage(Message message) { | |
try { | |
Gson gson = new Gson(); | |
new AccountServiceImpl().login("GroG", "password"); | |
RobotService service = new RobotServiceImpl(); | |
Robot robot = service.list().get(0); |
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
class CloudMessage { | |
public Message message; | |
public String robotId; | |
public String propertyId; | |
Message getMessage() { | |
return message; | |
} |
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
{ | |
'{"msgID":1407993577245,"timeStamp":1407993577245,"name":"cloud","sender":"arduino","sendingMethod":"publishPin","historyList":': { | |
'"cloud"],"method":"publishPin","data"': { | |
'{"pin":3,"type":2,"value":0,"source":"arduino"}]': '' | |
} | |
} | |
} |
NewerOlder