TypeError: fetch failed
at fetch (/node_modules/undici/index.js:109:13) {
[cause]: TypeError: Invalid URL
at new URL (node:internal/url:804:36)
at parseURL (/node_modules/undici/lib/core/util.js:51:11)
at Object.parseOrigin (/node_modules/undici/lib/core/util.js:117:9)
at new Pool (/node_modules/undici/lib/dispatcher/pool.js:70:23)
at Agent.defaultFactory (/node_modules/undici/lib/dispatcher/agent.js:22:7)
at [dispatch] (/node_modules/undici/lib/dispatcher/agent.js:93:34)
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 interface_Coffee { |
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 Benchmark = require('benchmark') | |
const co = require('co') | |
const bluebird = require('bluebird') | |
const suite = new Benchmark.Suite | |
suite | |
.add('co generators', { | |
defer: true, | |
fn: deferred => { |
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 axios = require('axios') | |
/* ... */ | |
const params = new URLSearchParams() | |
params.append('name', 'Akexorcist') | |
params.append('age', '28') | |
params.append('position', 'Android Developer') | |
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/') | |
params.append('awesome', true) |
Commonly, npm modules are source controlled using a single dedicated repo for each module. When forking and patching such an existing npm module, typical approaches are either:
- reference a specific git commit in your forked repo
"dependencies": {
"patchedmodule": "git+https://github.com/myuser/patchedmodule.git#mypatch"
}
- reference a downloadable tarball containing the same, as described in this post on {debuggable}
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
Promise.all([ | |
someThingThatReturnsAPromise(), | |
otherThingThatReturnsAPromise(), | |
lastThingThatReturnsAPromise() | |
]) | |
.then( results => | |
{ | |
// this... | |
const [first, second, third] = results; | |
// ... instead of |
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
<html> | |
<body bgcolor=000000> | |
<table boder=0 cellpadding=0 cellspacing=0> | |
<tr height=3> | |
<td width=3 bgcolor=888888 rowspan=105></td> | |
<td bgcolor=888888 colspan=54></td> | |
<td width=3 bgcolor=888888 rowspan=105></td> | |
</tr> |
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
'use strict'; | |
//mock for superagent - __mocks__/superagent.js | |
var mockDelay; | |
var mockError; | |
var mockResponse = { | |
status() { | |
return 200; | |
}, |
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
// Restify Server CheatSheet. | |
// More about the API: http://mcavage.me/node-restify/#server-api | |
// Install restify with npm install restify | |
// 1.1. Creating a Server. | |
// http://mcavage.me/node-restify/#Creating-a-Server | |
var restify = require('restify'); |
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
// mylogic.js | |
var MyLogic = { | |
_currentAccount: null, | |
fetchAccountByID: function(id) { | |
// fetch account from database, use promises to reject/resolve | |
}, | |
setCurrentAccount: function(account) { | |
MyLogic._currentAccount = account; | |
} |
NewerOlder