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 yandexUrl = "https://translate.yandex.net/api/v1.5/tr.json/translate"; | |
var yandexKey = "trnsl.1.1.20160825T224654Z.60d8da3a9f67c52b.ba2dfcc5fcd88c42ed64e266a52c105911fce47c"; | |
function getMessageActions(bubble) { | |
return [[ | |
"Translate", | |
function(bubble, peers) { | |
var url = yandexUrl + "?key=" + yandexKey + "&lang=en-es&text=" + encodeURI(bubble.body); | |
util.fetch(url).then(function(response) { | |
var json = JSON.parse(response.body); |
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
function getMessageActions(bubble) { | |
return [[ | |
"Like", | |
function(bubble, peers) { peers.send("like", "1") }, | |
function(bubble, peers) { peers.send("like", "-1") }, | |
]] | |
} | |
var actionHandlers = { | |
'like': function(bubble, value) { |
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 Foundation | |
@objc protocol FooProtocol { | |
var bar: Set<String> { get set } | |
} | |
class Foo : FooProtocol { | |
var bar = Set<String>() | |
} |
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
@objc protocol FooProtocol { | |
var bar: Set<String> { get set } | |
} | |
class Foo : FooProtocol { | |
var bar = Set<String>() | |
} | |
let a = Foo() | |
func toggle(foo: FooProtocol, item: String) { |
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
syntax = "proto3"; | |
option go_package = "pb"; | |
// Abbreviated information about a user, useful for displaying their name | |
// or avatar. | |
message User { | |
string ident = 1; | |
string name = 2; | |
} |
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
syntax = "proto3"; | |
option go_package = "pb"; | |
import "common.proto"; | |
// When bots are invoked, they are done so with this structure. | |
// Note that the oneof (union) mapping into json is simple: only one of the | |
// fields is populated. | |
message BotInvocation { |