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 addPromise = (a, b) => new Promise((resolve, reject) => { | |
| if (isNaN(a) === false && isNaN(b) === false) { | |
| resolve(a + b) | |
| } else { | |
| reject('a or b, is not a number') | |
| } | |
| }) | |
| addPromise(1, 2).then(resolved => { | |
| console.log(`promise resolved with ${resolved}`) | |
| return addPromise(1, 3) |
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 cacheObject = { | |
| name: '1', | |
| precache: [ | |
| './html/index.html', | |
| './css/index.css', | |
| './js/index.js', | |
| './', | |
| './robots.txt', | |
| './manifest.webmanifest', | |
| './favicon.ico', |
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
| this.addEventListener('fetch', event => { | |
| console.log(`fetch event request url: ${event.request.url}`) | |
| event.respondWith( | |
| caches.match(event.request).then(cacheResponse => { | |
| if (event.request.url.indexOf('.html') !== -1 || event.request.url === `https://www.${domainName}.${tld}/`) { | |
| return fetch(event.request.url).then(response => { | |
| return caches.open(cacheObject.name).then(cache => { | |
| cache.put(event.request, response.clone()).catch(error => { | |
| console.log('Could not add to cache!' + error) | |
| }) |
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 https = require('https') | |
| const colors = require('colors') | |
| let gthreads = [] | |
| let polthreads = [] | |
| let bizthreads = [] | |
| const catalogPromise = (board) => { | |
| return new Promise((resolve, reject) => { | |
| let path = `/${board}/catalog.json` |
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 fs = require('fs') | |
| const https = require('https') | |
| const colors = require('colors') | |
| const moment = require('moment-timezone') | |
| const querystring = require('querystring') | |
| const util = require('util') | |
| const crypto = require('crypto') | |
| const percentOf = (per, num) => { | |
| return (num / 100) * per |
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 fs = require('fs') | |
| const https = require('https') | |
| const colors = require('colors') | |
| const moment = require('moment-timezone') | |
| const querystring = require('querystring') | |
| const util = require('util') | |
| const crypto = require('crypto') | |
| const percentOf = (per, num) => { | |
| return (num / 100) * per |
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 fs = require('fs') | |
| const https = require('https') | |
| const colors = require('colors') | |
| const moment = require('moment-timezone') | |
| const querystring = require('querystring') | |
| const percentOf = (per, num) => { | |
| return (num / 100) * per | |
| } | |
| const percentChange = (v1, v2) => { |
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 colors = require('colors') | |
| const binanceAPI = options => { | |
| return new Promise((resolve, reject) => { | |
| try { | |
| let requestObject = { | |
| host: 'api.binance.com', | |
| port: 443, | |
| method: options.method | |
| } | |
| switch (`${options.method} ${options.endpoint}`) { |
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 https = require('https') | |
| const binanceAPI = options => { | |
| return new Promise((resolve, reject) => { | |
| try { | |
| let requestObject = { | |
| host: 'api.binance.com', | |
| port: 443, | |
| method: options.method | |
| } | |
| switch (`${options.method} ${options.endpoint}`) { |
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 https = require('https'), | |
| colors = require('colors'), | |
| moment = require('moment') | |
| const catalogPromise = (board) => { | |
| return new Promise((resolve, reject) => { | |
| let path = `/${board}/catalog.json` | |
| let url = `https://a.4cdn.org${path}` | |
| let req = https.request({ | |
| host: 'a.4cdn.org', |
NewerOlder