Skip to content

Instantly share code, notes, and snippets.

View kajornsakp's full-sized avatar
:shipit:

Kajornsak Peerapathananont kajornsakp

:shipit:
View GitHub Profile
@kajornsakp
kajornsakp / gist:753425ab215dd7289b00303ebe61c8d2
Created April 12, 2021 08:17
mdev : pull latest develop and merge into current working branch
alias mdev='GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) && git checkout develop && git pull && git checkout $GIT_BRANCH && git merge develop'
@kajornsakp
kajornsakp / panel.json
Created March 22, 2021 18:18
Talaiot example
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
platform :ios do
desc "Distribute iOS App to Firebase App Distribution"
lane :firebase_distribute do
enable_automatic_code_signing
build_ios_app(
scheme: "firebaseDistribution",
workspace: "firebaseDistribution.xcworkspace")
firebase_app_distribution(
app: "1:453826819908:ios:cda659fb15ab9128",
groups: "QA",
@kajornsakp
kajornsakp / Fastfile
Last active September 26, 2019 15:14
default_platform(:ios)
platform :ios do
desc "Distribute iOS App to Firebase App Distribution"
lane :firebase_distribute do
enable_automatic_code_signing
build_ios_app(
scheme: "firebaseDistribution",
workspace: "firebaseDistribution.xcworkspace",
export_xcargs: "-allowProvisioningUpdates")
func insertMessage(sender: Sender, text: String) {
let date = Date.init()
let message = Message(sender: sender, messageId: "1", sentDate: date, kind: .text(text))
messages.append(message)
conversation.append(TextMessage(text: text, timestamp: date.timeIntervalSince1970, userID: sender.id, isLocalUser: isJohn))
messagesCollectionView.reloadData()
handleSmartReply()
}
func handleSmartReply() {
var conversation: [TextMessage] = []
// Then, for each message sent and received:
let message = TextMessage(
text: "How are you?",
timestamp: Date().timeIntervalSince1970,
userID: "userId",
isLocalUser: false)
conversation.append(message)
// ข้างใน Podfile
pod 'Firebase/Core'
pod 'Firebase/MLCommon'
pod 'Firebase/MLNLSmartReply'
// จากนั้นก็ทำการ pod install ซะะ
naturalLanguage.smartReply().suggestReplies(for: conversation) { result, error in
guard error == nil, let result = result else {
return
}
if (result.status == .notSupportedLanguage) {
// The conversation's language isn't supported, so the
// the result doesn't contain any suggestions.
} else if (result.status == .success) {
// Successfully suggested smart replies.
// ...
/**
* A single chat message, to be used as an array element for input to Smart Reply.
*/
NS_SWIFT_NAME(TextMessage)
@interface FIRTextMessage : NSObject
/**
* Text of the chat message.
*/
@property(nonatomic, readonly) NSString *text;
/**
val options = FirebaseLanguageIdentificationOptions.Builder().setConfidenceThreshold(0.5f).build()
val languageIdentification = FirebaseNaturalLanguage.getInstance().getLanguageIdentification(options)
//languageIdentification.identifyLanguage(...)