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 eventEmitter() { | |
| const state = {} | |
| return { | |
| subscribe: (channel, fn) => { | |
| state[channel] = fn | |
| }, | |
| emit: (channel, ...param) => { | |
| if (state[channel]) { | |
| state[channel](...param) | |
| } |
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 from 'react' | |
| import { render } from 'react-dom' | |
| import { routes } from './scheme-route' | |
| import { StaticRouter } from 'react-router-dom' | |
| render(( | |
| <StaticRouter> | |
| {routes} | |
| </StaticRouter> | |
| ), 0) |
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 path = require('path') | |
| const webpack = require('webpack') | |
| const merge = require('webpack-merge') | |
| const WebpackBabelExternalsPlugin = require('webpack-babel-external-helpers-2') | |
| const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin | |
| const UglifyJSPlugin = require('uglifyjs-webpack-plugin') | |
| const ExtractTextPlugin = require('extract-text-webpack-plugin') | |
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 Perceptron { | |
| constructor(bias=1,learningRate=0.1,weights=[]) { | |
| this.bias = bias; | |
| this.learningRate = learningRate; | |
| this.weights = weights; | |
| this.trainingSet = []; | |
| } | |
| init(inputs,bias=this.bias) { | |
| // Initialize weights to 0 and adding bias weight |
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
| export const cancelablePromise = (promise) => { | |
| let state = false | |
| const prom = (...param) => | |
| new Promise((resolve, reject) => { | |
| promise(...param) | |
| .then((res) => { | |
| if (!state) resolve(res) | |
| }) | |
| .catch((err) => { | |
| if (!state) reject(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
| def file(name, flag = False): | |
| f = open(name) | |
| if flag == 'w': | |
| return f | |
| return f.readlines() | |
| def readfile(filename): | |
| lines = [line for line in file(filename)] | |
| print(len(lines)) | |
| # First line is the column titles |
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
| var dictinary = {}; | |
| function addWord(word, value) { | |
| value = value ? value : word | |
| var letters = word.split('') | |
| var newDic = letters.reduce((prev, curr, i) => { | |
| if (letters.length -1 === i) { | |
| return prev[curr] = value | |
| } | |
| return prev[curr] ? prev[curr] : prev[curr] = {} |
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
| <audio src="song.mp3" id="myAudio"></audio> |
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
| /* | |
| нужно расчитать график касиров | |
| каждый касир должен работать не больше 5 дней в неделю И не больше 9 часов в день | |
| рабочий день начинаеться с 8 до 23 - 15 раб часов | |
| * --------------------- | |
| const kAll = 70 // кол-во касиров всего | |
| let k = 0 // кол-во касиров в день (нужно найти эту переменную) | |
| let p = 0 // поток покупателей | |
| let t = 0 // время (от 8 до 23) |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>brain</title> | |
| </head> | |
| <body> | |
| <script type="text/javascript"> | |
| /*------example------ | |
| exampleInputData = [0,1,2,3,4,5,6] | |
| exampleOutputData = [1,3,5] |