This file contains hidden or 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 SSID = 'alexander'; | |
| const PASSWORD = '12341234'; | |
| const button = require('@amperka/button').connect(P7, { holdTime: 0.6 }); | |
| const led = require('@amperka/led').connect(P6); | |
| const memory = require('@amperka/card-reader').connect(P8); | |
| const http = require('http'); | |
| const wifi = require('@amperka/wifi').setup((err) => { | |
| if (err) { |
This file contains hidden or 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 SSID = 'alexander'; | |
| const PASSWORD = '12341234'; | |
| const NAME = 'my-temperature'; | |
| const button = require('@amperka/button').connect(P7, { holdTime: 0.6 }); | |
| const led = require('@amperka/led').connect(P6); | |
| const dweet = require('@amperka/dweetio').connect(NAME); | |
| const memory = require('@amperka/card-reader').connect(P8); | |
| const server = require('@amperka/server').create(); |
This file contains hidden or 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
| interface IComplexState { | |
| reaction: TReactionType | null, | |
| progress: boolean; | |
| somethingElse: string; | |
| } | |
| type TComplexReducer = Reducer<IComplexState, IAction>; | |
| type TComplexState = [ | |
| ReducerState<TComplexReducer>, |
This file contains hidden or 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 Like from 'assets/mg/reactions/reactions__icon_reaction_Like.svg'; | |
| import LikeBig from 'assets/mg/reactions/reactions__icon_reaction_Like-big.svg'; | |
| import Haha from 'assets/mg/reactions/reactions__icon_reaction_Haha.svg'; | |
| import HahaBig from 'assets/mg/reactions/reactions__icon_reaction_Haha-big.svg'; | |
| import Wow from 'assets/mg/reactions/reactions__icon_reaction_Wow.svg'; | |
| import WowBig from 'assets/mg/reactions/reactions__icon_reaction_Wow-big.svg'; | |
| // todo: вернуть обратно на Bored, когда закончится пандемия коронавирусом | |
| import Bored from 'assets/mg/reactions/reactions__icon_reaction_Virus.svg'; | |
| import BoredBig from 'assets/mg/reactions/reactions__icon_reaction_Virus-big.svg'; | |
| import Sad from 'assets/mg/reactions/reactions__icon_reaction_Sad.svg'; |
This file contains hidden or 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 React, { useEffect, useContext } from "react"; | |
| import "./styles.css"; | |
| const isNode = true; | |
| const baobab = isNode ? { name: "page", children: [] } : null; | |
| const Ctx = React.createContext(baobab); | |
| function useBaobab(name, attrs) { | |
| const id = Math.random(); |
This file contains hidden or 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
| /** | |
| * Какого числа мне будет доступно N дней отпуска? | |
| */ | |
| var start = '2019-09-10'; | |
| var days = 6; | |
| console.log(`Заданное количество дней (${days}) будет доступно`, new Date(new Date(start).getTime() + 365 / 28 * days * 3600 * 24 * 1000)); | |
| /** | |
| * Сколько дней отпуска мне будет доступно X числа? |
This file contains hidden or 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 limits = { | |
| 5000: 30456574, | |
| 1000: 1567567567454, | |
| 500: 245675675, | |
| 100: 34566756673, | |
| 50: 23567400 | |
| }; | |
| function atm (sum, limits) { | |
| const obj = Object.create( null ); |
This file contains hidden or 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
| class ListNode { | |
| constructor (val) { | |
| this.val = val; | |
| this.next = this.prev = null; | |
| } | |
| } | |
| class Queue { | |
| constructor () { | |
| this._head = null; |
This file contains hidden or 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 urls = [ | |
| 'https://ya.ru', | |
| 'https://vk.com', | |
| 'https://vk.com', | |
| 'https://vk.com', | |
| 'https://vk.com', | |
| 'https://vk.com', | |
| 'https://vk.com', | |
| 'https://vk.com', | |
| 'https://vk.com', |
This file contains hidden or 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 atm (sum, limits) { | |
| const obj = {}; | |
| let cur = 0; | |
| const arr = Object.keys( limits ).map(Number).sort((a, b) => b - a); | |
| let i = 0; | |
| while (i < arr.length) { | |
| const v = arr[i]; | |
| const c = Math.floor( sum / v ); | |
| const mc = Math.min( limits[ v ], c ); | |
| i++; |