Skip to content

Instantly share code, notes, and snippets.

View iztsv's full-sized avatar
🐢
...

ztsv iztsv

🐢
...
  • Siberia, Novosibirsk
View GitHub Profile
@stepankuzmin
stepankuzmin / koa.re
Created August 11, 2017 20:39
ReasonML Koa interop experiment
module Koa = {
type t;
type ctx = {. body : ref string};
/** [make ()] creates an instance of the Koa class. */
external make : unit => t = "koa" [@@bs.new] [@@bs.module];
external listen : t => int => unit = "listen" [@@bs.send];
external use : t => (ctx => unit) [@bs.uncurry] => unit = "use" [@@bs.send];
};
@ccnokes
ccnokes / axios-instance-config.js
Created July 6, 2017 16:23
Good default configuration for axios in node.js
const axios = require('axios');
const http = require('http');
const https = require('https');
module.exports = axios.create({
//60 sec timeout
timeout: 60000,
//keepAlive pools and reuses TCP connections, so it's faster
httpAgent: new http.Agent({ keepAlive: true }),
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 14, 2025 19:31
Hyperlinks in Terminal Emulators
@denji
denji / README.md
Last active May 7, 2025 07:38 — forked from Cubixmeister/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@newcloudtech
newcloudtech / karma.config.js
Last active June 15, 2021 04:00
Webpack and karma configs
var webpackConfig = require('../webpack.config.js');
module.exports = function () {
autoWatch: true,
frameworks: ['jasmine'],
preprocessors: {
'../app/**/*.js': ['webpack'],
'../app/**/scripts/**/*.js': ['coverage']
},
webpack: {
resolve: webpackConfig.resolve,
@ljharb
ljharb / array_iteration_thoughts.md
Last active April 15, 2025 03:33
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@znechai
znechai / pluralize-ru.js
Last active April 26, 2025 16:57
JavaScript - Plural forms for russian words
/**
* Plural forms for russian words
* @param {Integer} count quantity for word
* @param {Array} words Array of words. Example: ['депутат', 'депутата', 'депутатов'], ['коментарий', 'коментария', 'комментариев']
* @return {String} Count + plural form for word
*/
function pluralize(count, words) {
var cases = [2, 0, 1, 1, 1, 2];
return count + ' ' + words[ (count % 100 > 4 && count % 100 < 20) ? 2 : cases[ Math.min(count % 10, 5)] ];
}
@bendc
bendc / supportsES6.js
Created August 25, 2016 08:05
Test if ES6 is ~fully supported
var supportsES6 = function() {
try {
new Function("(a = 0) => a");
return true;
}
catch (err) {
return false;
}
}();