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
const {range} = require('rxjs') | |
const {filter, map, take, toArray} = require('rxjs/operators') | |
export default { | |
odd: function(value) { | |
return filter((x)=>x%2) | |
}, | |
get1to10: function() { | |
return range(1, 10) | |
}, |
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 Strim from 'strim-js' | |
new Strim() | |
.pipe({ | |
module: 'dom', | |
func: 'getDataFromElements', | |
args: ['#userInput1','#userInput2','#userInput3','#userInput4'], | |
}) | |
.toWorker() | |
.pipe({ | |
module: 'dataCrunch', |
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 {setStrimModules, setWs} from 'strim-js' | |
import http from 'http' | |
import express from 'express' | |
import bodyParser from 'body-parser' | |
import path from 'path' | |
const app = express() | |
const STATIC_FILES_DIRECTORY = path.join(__dirname, '../client/static') | |
app.use(bodyParser.json()) |
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": "numbersModule", | |
"version": "1.0.0", | |
"description": "", | |
"main": "numbers.js", | |
"scripts": { | |
"test": "jest" | |
}, | |
"keywords": [], | |
"author": "", |
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 getRandomInt(max) { | |
return Math.floor(Math.random() * Math.floor(max)) | |
} | |
module.exports = { | |
increase: function(value) { | |
return value + 1 | |
}, | |
random: function() { | |
return getRandomInt(100) |
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 config from 'config' | |
import botCommander from '../botCommander' | |
import broadlinkController from '../broadlinkController' | |
import CONSTS from '../consts' | |
function getRoomFromData(data, command) { | |
return data.substr(0, data.length - command.length) | |
} | |
function isAdmin(msg) { |
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 broadlinkController from "../broadlinkController"; | |
import botCommander from "../botCommander"; | |
export default async function(msg) { | |
const id = msg.from.id; | |
const name = msg.from.first_name; | |
const devices = await broadlinkController.getDevices(); | |
const inline_keyboard = [ |
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 botCommander from './botCommander'; | |
const commandsConfig = [{ | |
name: 'start', | |
regex: /\/start$/, | |
disabled: false, | |
description: 'let the bot help you around', | |
},{ | |
name: 'callback', | |
disabled: false, | |
}]; |
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 config from 'config' | |
import TelegramBot from 'node-telegram-bot-api' | |
const options = { | |
polling: true, | |
} | |
const bot = new TelegramBot(config.BOT_TOKEN, options) | |
const allKeyboardOpts ={ | |
reply_markup:JSON.stringify({ |
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 fs from 'fs-extra' | |
import path from 'path' | |
import Broadlink from './Broadlink' | |
import CONSTS from './consts' | |
import logger from './logger' | |
const b = new Broadlink() | |
import {LIVINGROOM_KEY, BEDROOM_KEY, WORKROOM_KEY} from './keys' | |
export const devicesReady = new Promise(resolve => { | |
const devices = {}; |
NewerOlder