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 axios from 'axios' | |
| const MAX_REQUESTS_COUNT = 5 | |
| const INTERVAL_MS = 10 | |
| let PENDING_REQUESTS = 0 | |
| // create new axios instance | |
| const api = axios.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
| /** | |
| * Convert ISO 8601 values like PT15M33S | |
| * to a total value of seconds. | |
| * | |
| * @param string $ISO8601 | |
| */ | |
| function ISO8601ToSeconds($ISO8601) | |
| { | |
| preg_match('/\d{1,2}[H]/', $ISO8601, $hours); | |
| preg_match('/\d{1,2}[M]/', $ISO8601, $minutes); |
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
| package main | |
| // http://play.golang.org/p/jZ5pa944O1 <- will not display the colors | |
| import "fmt" | |
| const ( | |
| InfoColor = "\033[1;34m%s\033[0m" | |
| NoticeColor = "\033[1;36m%s\033[0m" | |
| WarningColor = "\033[1;33m%s\033[0m" | |
| ErrorColor = "\033[1;31m%s\033[0m" | |
| DebugColor = "\033[0;36m%s\033[0m" |
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 random_text( $type = 'alnum', $length = 8 ) | |
| { | |
| switch ( $type ) { | |
| case 'alnum': | |
| $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
| break; | |
| case 'alpha': | |
| $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
| break; | |
| case 'hexdec': |