Skip to content

Instantly share code, notes, and snippets.

View BuistvoPloti's full-sized avatar
fast furious

Denis BuistvoPloti

fast furious
  • Toronto, Canada
View GitHub Profile
@guest271314
guest271314 / undici_fetch_throwing_on_file_protocol_request.md
Created March 24, 2024 02:52
undici@6.10.1 fetch() throwing for file: protocol request
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)
@DmitriiNazimov
DmitriiNazimov / pattern-decorator.js
Last active April 25, 2024 15:22
[JS ES6 Паттерн ДЕКОРАТОР (decorator)] #Паттерны #ООП #js #ES6
/**
*
* ПАТТЕРН ДЕКОРАТОР (обертка)
* Позволяет наделить обьект новыми возможностями не меняя первоначальный класс и не создавая дочерние классы
* Принцип работы: декоратор помещает целевой обьект в обьект обертку, кот-й запускает базовое поведение обьекта,
* а затем добавляет/отнимает что-то свое.
*
*/
class interface_Coffee {
@joseluisq
joseluisq / generators-vs-asyncawait-vs-native-promises.js
Last active April 26, 2021 11:52 — forked from netroy/generators-vs-asyncawait-vs-native-promises.js
Native Promises vs Generators vs Async/Await Performance vs Bluebird Promises
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 => {
@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
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)
@stephen-peck
stephen-peck / README.md
Created September 7, 2017 15:58
Forking and patching npm modules from a monorepo

Forking and patching npm modules from a monorepo

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"
    }
@JesterXL
JesterXL / promiseall.js
Last active October 31, 2022 16:02
Example of using Array Destructuring for Promise.all.
Promise.all([
someThingThatReturnsAPromise(),
otherThingThatReturnsAPromise(),
lastThingThatReturnsAPromise()
])
.then( results =>
{
// this...
const [first, second, third] = results;
// ... instead of
@jaysn
jaysn / Udongein.html
Created April 9, 2017 11:37
Reisen Udongein html table
<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>
@pherris
pherris / superagent.js
Last active January 19, 2021 15:10
Jest superagent mock
'use strict';
//mock for superagent - __mocks__/superagent.js
var mockDelay;
var mockError;
var mockResponse = {
status() {
return 200;
},
// 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');
@lingo
lingo / gist:5e53d2cb5b282d53d912
Last active May 9, 2022 21:19
Separation of logic from request handlers
// mylogic.js
var MyLogic = {
_currentAccount: null,
fetchAccountByID: function(id) {
// fetch account from database, use promises to reject/resolve
},
setCurrentAccount: function(account) {
MyLogic._currentAccount = account;
}