Skip to content

Instantly share code, notes, and snippets.

View deanshub's full-sized avatar

Dean Shub deanshub

View GitHub Profile
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)
},
import Strim from 'strim-js'
new Strim()
.pipe({
module: 'dom',
func: 'getDataFromElements',
args: ['#userInput1','#userInput2','#userInput3','#userInput4'],
})
.toWorker()
.pipe({
module: 'dataCrunch',
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())
{
"name": "numbersModule",
"version": "1.0.0",
"description": "",
"main": "numbers.js",
"scripts": {
"test": "jest"
},
"keywords": [],
"author": "",
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max))
}
module.exports = {
increase: function(value) {
return value + 1
},
random: function() {
return getRandomInt(100)
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) {
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 = [
import botCommander from './botCommander';
const commandsConfig = [{
name: 'start',
regex: /\/start$/,
disabled: false,
description: 'let the bot help you around',
},{
name: 'callback',
disabled: false,
}];
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({
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 = {};