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
| /** | |
| * @private | |
| */ | |
| const FA = 0; | |
| /** | |
| * @private | |
| */ | |
| const EN = 1; | |
| /** | |
| * @private |
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
| let count = 0; | |
| let running = false; | |
| const queue = {}; | |
| const addTask = task => { | |
| queue[count++] = task; | |
| if (running === false) runTasks(); | |
| } | |
| const runTasks = async () => { |
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
| ## | |
| # You should look at the following URL's in order to grasp a solid understanding | |
| # of Nginx configuration files in order to fully unleash the power of Nginx. | |
| # https://www.nginx.com/resources/wiki/start/ | |
| # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ | |
| # https://wiki.debian.org/Nginx/DirectoryStructure | |
| # | |
| # In most cases, administrators will remove this file from sites-enabled/ and | |
| # leave it as reference inside of sites-available where it will continue to be | |
| # updated by the nginx packaging team. |
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 {exec} = require('child_process'); | |
| function git(args) { | |
| return new Promise(res => { | |
| exec('git ' + args, (err, stdout, stderr) => { | |
| if (err) { | |
| throw err; | |
| } else { | |
| res(stdout.trim()); | |
| } |
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, { Component } from "react"; | |
| import { | |
| BrowserRouter, | |
| Route, | |
| Switch, | |
| Link, | |
| Redirect, | |
| withRouter | |
| } from "react-router-dom"; |
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 { createStore } from "redux"; | |
| import { connect, Provider } from "react-redux"; | |
| const ACTIONS_INC = "ACTIONS_INC"; | |
| const ACTIONS_DEC = "ACTIONS_DEC"; | |
| function counter(state = { count: 0 }, { type }) { | |
| const actions = { | |
| [ACTIONS_INC]: () => ({ count: state.count + 1 }), |
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
| /** | |
| * @version 2 | |
| * @description memoized function for better performance | |
| * @param {function} func | |
| * @returns {function} func | |
| */ | |
| function memoize(func){ | |
| const cache = new Map(); | |
| return (...args)=>{ | |
| const key = args.join(''); |
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
| /* | |
| * Commons array | |
| * when array is sorted | |
| */ | |
| function commons(a, b) { | |
| const result = []; | |
| let i = j = 0; | |
| cancel:while (true) { | |
| if (a[i] > b[j]) j++; | |
| else if (a[i] < b[j]) i++; |
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, { useState, useEffect } from "react"; | |
| let initialState = { | |
| count: 0, | |
| num: 0 | |
| }; | |
| let globalState = { ...initialState }; | |
| const listeners = []; |
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, { useReducer, createContext, useContext, useEffect } from "react"; | |
| import { on, emit } from "jetemit"; | |
| const initialValue = { X: 0, Y: 0 }; | |
| const reducer = (state, action) => { | |
| switch (action.type) { | |
| case "+": | |
| return { | |
| ...state, | |
| X: state.X + 1 |
OlderNewer