Instantly share code, notes, and snippets.

View index.js
import RingCentral from 'ringcentral-js-concise'
import PubNub from 'ringcentral-js-concise/src/pubnub.es5'
import delay from 'timeout-as-promise'
const rc = new RingCentral(
process.env.RINGCENTRAL_CLIENT_ID,
process.env.RINGCENTRAL_CLIENT_SECRET,
process.env.RINGCENTRAL_SERVER_URL
)
View Result.md
updating device 803480313004
{ uri:
   'http://api-xmnup.lab.nordigy.ru/restapi/v1.0/account/225033004/device/803480313004',
  id: '803480313004',
  type: 'HardPhone',
  sku: 'HP-52',
  model: { id: '52', name: 'Cisco SPA-122 ATA', addons: [] },
  name: 'Phone',
  serial: 'HELL803480313004-225033004',
View README.md

Why is SubX more developer-friendly than Redux & MobX?

First of all, what is SubX?

SubX, Subject X, Reactive Subject. Pronunciation: [Sub X]

SubX is next generation state container. It could replace Redux and MobX in our React apps.

Features of SubX

View index.js
const RingCentral = require('ringcentral')
const dotenv = require('dotenv')
dotenv.config()
const token = JSON.parse(process.env.token)
const rc = new RingCentral({
server: RingCentral.server.sandbox,
appKey: '',
appSecret: ''
})
View callcenter.xml
<callCenter>
<section sortOrder="0" name="reqGeneralInfo" label="General Information">
<item sortOrder="0" name="reqInternalName" label="Internal Name">RingCentralAdapterOpenCTI</item>
<item sortOrder="1" name="reqDisplayName" label="Display Name">RingCentral Call Center Adapter Open CTI</item>
<item sortOrder="2" name="reqAdapterUrl" label="CTI Adapter URL">/apex/RCPhone</item>
<item sortOrder="3" name="reqUseApi" label="Use CTI API">true</item>
<item sortOrder="4" name="reqSoftphoneHeight" label="Softphone Height">550</item>
<item sortOrder="5" name="reqSoftphoneWidth" label="Softphone Width">300</item>
<item sortOrder="6" name="reqSalesforceCompatibilityMode" label="Salesforce Compatibility Mode">Lightning</item>
</section>
View README.md

Environment

  • Node v8.1.2
  • macOS 10.12.5
  • MacBook Pro (Retina, 15-inch, Mid 2015)

Speed (faster come first)

Ramda > Lodash > reduce > filter > for

View README.md
  • 押金 3000

  • 物业费 11月8号 - 3月7号 共 4 个月,每月 47.5 元, 共 190

  • 电费 已通过支付宝生活缴费缴清3月份之前的,本月 1-7 号酌情给 20

  • 水费 支付宝生活缴费最近几个月一直显示未欠费

  • 煤气费 支付宝生活缴费一开始两个月显示未欠费,后来显示的数额比较大,相当之前半年多的费用。

故对以上水费、煤气费另外计算。

  • 上一次抄表是11月10号,水表 0009, 煤气表 269.5
View passed.json
{
"payload": "{\"id\":201403814,\"repository\":{\"id\":12072164,\"name\":\"travis-webhook-demo\",\"owner_name\":\"tylerlong\",\"url\":null},\"number\":\"5\",\"config\":{\"language\":\"node_js\",\"node_js\":[\"7.5\"],\"notifications\":{\"webhooks\":{\"urls\":[\"http://devproxy-public.asialab.glip.net/webhook-tyler.liu/ea7f2d9e-91a1-4ae4-bd9b-1737c39908ec\"],\"on_success\":\"always\",\"on_failure\":\"always\",\"on_start\":\"always\"}},\".result\":\"configured\",\"group\":\"stable\",\"dist\":\"precise\"},\"status\":0,\"result\":0,\"status_message\":\"Passed\",\"result_message\":\"Passed\",\"started_at\":\"2017-02-14T05:55:49Z\",\"finished_at\":\"2017-02-14T05:56:19Z\",\"duration\":30,\"build_url\":\"https://travis-ci.org/tylerlong/travis-webhook-demo/builds/201403814\",\"commit_id\":57662095,\"commit\":\"7a079a2999a54981d1e5ba4c668a90441234da2f\",\"base_commit\":null,\"head_commit\":null,\"branch\":\"master\",\"message\":\"Add one more test case\",\"compare_url\":\"https://github.com/tylerlong/travis-webhook
View reamde.md

Topic

聊天机器人(Chatbot)简介。Chatbot 无疑是当前非常火的一个研究领域和产品方向。Chatbot 是场交互革命,也是一个多技术融合的平台。 Chatbot 从形式上讲是电脑程序利用人工智能去和人类对话。其最原始的形式是电脑和人类通过文字进行交互。借助语音识别和文字转语音服务,可以实现类似真人之间的语言交互效果。Chatbot 的输入形式基本上是文字或者语音,输出形式却可以多种多样,比如文字、语音、图片、视频等等。

Chatbot 技术方兴未艾,Apple 公司的 Siri,Microsoft 公司的小冰,Amazon 的 Echo,谷歌公司前不久收购了api.ai……国际巨头纷纷在这一领域布局。另外一家不得不提的公司是 Slack,这家公司在成立不到一年的时候估值已经超过了30亿,众多第三方公司围绕 Slack 打造了一个 Chatbot 生态。种种迹象表明,Chatbot 技术绝对是未来 5 到 10 年最值得投资的技术。

Lectuer

View replace-hubot.md

I am thinking maybe it's better to create our own bot platform to replace hubot. I have several reasons to say so:

  1. Hubot is simple, It's easy to replace it. Basically what hubot does is: receive and send messages (via adapters), match with regex and invoke scripts.
  2. It's not hard to reuse existing hubot scrits for other bot platforms. Most hubot scrits are quite regular, thanks to the simplicity of Hubot. We could even write a tool to migrate exiting hubot scripts automatically.
  3. Hubot has long history but it has never been truely popular. Which implies that there are essential architectural defeats.
    1. It doesn't provide enough levels of abstraction from OOA's perspective. It only provides end programmers with the concept of "scripts".
    2. A "script" file (js or coffee) could have several "scripts", and the help information of those scripts are read from the comments of the source code.
    3. The concept is confusing and the design is not very elegant.
  4. Hubot doesn't support complex opera