Skip to content

Instantly share code, notes, and snippets.

View edtoken's full-sized avatar

Eduard Titov edtoken

View GitHub Profile
@edtoken
edtoken / Javascript-Typescript-Knowledge-NOTE-v2.md
Last active May 6, 2024 11:54
Javascript-Typescript-Knowledge-NOTE-v2.md

See outdated v1 here

Description

Hello, my name is Ed. I am working on that document that aimed at assisting developers and myself in refreshing our knowledge related to our work with Typescript, Javascript, and other related technologies.

Think of this document as a "database" filled with useful resources. Some of the links may cover basic concepts; however, they could still prove to be valuable for some individuals!


@edtoken
edtoken / nvm-in-the-docker-Dockerfile
Last active October 9, 2019 09:58
Setup NVM in the docker Container
FROM node:8
RUN apt-get update && apt-get install -y -q --no-install-recommends \
apt-transport-https \
build-essential \
ca-certificates \
curl \
git \
libssl-dev \
wget \
import { Arg, Substitute } from '@fluffy-spoon/substitute';
/**
* @see https://www.npmjs.com/package/@fluffy-spoon/substitute
*/
describe('Mock functionality works correctly', () => {
it('tmp', () => {
interface Element {
readonly destroy: () => void;
}
@edtoken
edtoken / inline-multi-worker.js
Created August 22, 2018 08:30
Example for using multiple inline web workers
const createWorker = (function(){
let workerId = 0;
function worker(){
self.onmessage = function(e){
const received = new Date()
const {type, data, created} = e.data
switch(e.data.type){
function F(x){
this.x = x;
this.getSumm = function(y){
return x + y
}
}
var inst = new F(3); // вот тут мы получаем => {x: 3}
var result = inst.getSumm(2); // вот это сейчас не работает потому что нет getSumm, а должно вывести 5
@edtoken
edtoken / move-zero-to-end.js
Created February 16, 2018 21:07
Move all zeros to end.
function moveZeros(array) {
let i = 0;
let len = array.length;
let s = undefined;
let e = undefined;
while(i < len){
if(!array[i]){
if(s == undefined){
@edtoken
edtoken / Javascript-Russian-Knowledge-NOTE.md
Last active April 20, 2024 19:14
Javascript Russian Knowledge NOTE

OUTDATED

This this super outdated, see v2 here

Posts

https://egghead.io/
https://github.com/trekhleb/javascript-algorithms
https://habr.com/post/359192/ алгоритмы на js все
https://www.youtube.com/watch?v=j4_9BZezSUA event loop
https://fseby.wordpress.com/2016/02/25/практическая-вводная-в-монады-в-javascript/
https://habrahabr.ru/company/mailru/blog/327522/   (Функциональное программирование в JavaScript с практическими примерами)

@edtoken
edtoken / ajax-parallel-requests.js
Created February 10, 2018 16:21
Mock for ajax parallel requests
const call = (function() {
const maxParallelCalls = 5;
let activeCalls = 0;
let requestsStack = [];
// outside promise proxy
const Defer = function() {
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
const uniqPrefix = (() => {
let START_UNIQ_PREFIX = 0
const uniq = () => {}
uniq.toString = uniq.valueOf = () => {
START_UNIQ_PREFIX += 1
return `uniq${START_UNIQ_PREFIX}`
}
return uniq
})()

Шаг 1а: сплющивание через rebase -i Под git squash вы наверное понимаете git rebase --interactive с последующим выбором опции squash. Действительно, можно сделать так:

Ребейз к третьему коммиту с конца (пред-предпоследнему)

git rebase -i HEAD^^ откроется такой документ:

pick 7423f96 сообщение предпоследнего коммита pick 91e9b6e сообщение последнего коммита