Skip to content

Instantly share code, notes, and snippets.

View wmakeev's full-sized avatar
💭
💻

Makeev Vitaliy wmakeev

💭
💻
View GitHub Profile
@wmakeev
wmakeev / chan.js
Created August 3, 2024 23:14 — forked from benjamingr/chan.js
/*
Makes a channel that buffers up to n items
*/
function chan(n) {
const data = []; // data not yet read
const readersBacklog = []; // readers waiting for data
const writersBacklog = []; // writers waiting for data
let disposed = false;
// TODO(Benjamin) - disposing
@zerkalica
zerkalica / batch.ts
Last active March 28, 2023 18:39
batch fetch
type DataError = {
message?: string;
code: string;
}
class BatchError extends Error {
constructor(message: string, readonly code: string) {
super(message)
}
}
/*
Makes a channel that buffers up to n items
*/
function chan(n) {
const data = []; // data not yet read
const readersBacklog = []; // readers waiting for data
const writersBacklog = []; // writers waiting for data
let disposed = false;
// TODO(Benjamin) - disposing
@hartikainen
hartikainen / csv-to-arrow-table.js
Last active November 22, 2024 03:48
Create an arrow-js table from csv file using node streams
const assert = require('assert');
const fs = require('fs');
const stream = require('stream');
const _ = require('lodash');
const fastCsv = require('fast-csv');
const { metrohash64 } = require('metrohash');
const {
Bool, Utf8, Int32, Int64, Float32, Float64, Struct, Dictionary,
@Jonalogy
Jonalogy / handling_multiple_github_accounts.md
Last active May 7, 2025 12:46
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@wmakeev
wmakeev / .editorconfig
Last active January 7, 2018 13:55
Node.js project environment bootstrap #env #config #eslint
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@richard1122
richard1122 / TL.d.ts
Last active November 20, 2016 07:51
telegram typings
// A typings definition of some telegram data structure
// author: Richard He<[email protected]>
// https://gist.github.com/richard1122/1eb54cd4e422aeb707718ab307decd34
// see more detail: https://core.telegram.org/bots/api
declare namespace TL {
export interface IResponse<T> {
ok:boolean
result:T
}
@jlongster
jlongster / immutable-libraries.md
Last active November 7, 2024 13:11
List of immutable libraries

A lot of people mentioned other immutable JS libraries after reading my post. I thought it would be good to make a list of available ones.

There are two types of immutable libraries: simple helpers for copying JavaScript objects, and actual persistent data structure implementations. My post generally analyzed the tradeoffs between both kinds of libraries and everything applies to the below libraries in either category.

Libraries are sorted by github popularity.

Persistent Data Structures w/structural sharing

@PeterHancock
PeterHancock / README.md
Last active April 23, 2017 18:27
Running a node script on your $PATH with --harmony flag

Running a node script on your $PATH but with the --harmony flag

Some npm packaged scripts are written as frameworks that dynamically require user node scripts, e.g. the gulp CLI script requires the user provided Gulpfile.js (by default).

To write .js using ES6 syntax is problematic; if the $PATH script for a framework x looks like

#!/usr/bin/env node
var x = require('x');

...
@ericelliott
ericelliott / react-reusable-component.md
Last active January 8, 2025 09:50
React - Complete Reusable Component

React Reusable Component Factory

'use strict';

const ENTER_KEY = 13;

const emailFactory = function ({
  React,
  setEmail,