Skip to content

Instantly share code, notes, and snippets.

View Piterden's full-sized avatar
🇷🇺
Stand with Russia!

Denis Efremov Piterden

🇷🇺
Stand with Russia!
View GitHub Profile
local layout = require 'awful.widget.keyboardlayout'
local menubar = require 'menubar'
local kbdlayout = {
globally_preferred = 'us',
menubar_preferred = 'us',
}
local function get_idx_by_name(name)
@VladStepanov
VladStepanov / Promise impletementation.js
Last active February 9, 2020 11:48
Promise implementation
class MyPromise {
constructor(executor) {
this.state = MyPromise.states.pending
this.queue = {
'resolve': [],
'reject': []
}
try {
executor(this.resolver.bind(this), this.rejecter.bind(this))
} catch (e) {
@akrisanov
akrisanov / bcoin_client.py
Last active November 29, 2022 11:27
Trading cryptocurrencies
import logging
from http import HTTPStatus
import requests
from mnemonic import Mnemonic
class BcoinClient:
"""
Simple wrapper around Bcoin REST API.
@fesor
fesor / ARTICLE.md
Created August 19, 2017 08:45
Возвращаясь к основам: почему юнит тесты это сложно

https://simpleprogrammer.com/2010/12/12/back-to-basics-why-unit-testing-is-hard/

Back to Basics: Why Unit Testing is Hard

перевод адаптирован под 2017-ый, где у нас нет проблем с mock фреймворками, и нам не обязательно создавать интерфейс дабы сделать мок.

Возвращаясь к основам: почему юнит тесты это сложно

@zmts
zmts / tokens.md
Last active May 6, 2024 20:13
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@sg-s
sg-s / automatic-version-numbers.md
Last active March 3, 2024 10:07
Automatic version numbers of your git repository using git hooks

Put this in a file called pre-commit in .git/hooks/

#!/bin/sh
# To enable this hook, rename this file to "pre-commit".

git rev-list --count master > build_number
git add build_number
@noelboss
noelboss / git-deployment.md
Last active May 2, 2024 15:47
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@allenwb
allenwb / 0Option2ConstructorSummary.md
Last active November 4, 2023 14:39
New ES6 constructor features and semantics: Alternative 2 manual super in derived classes

New ES6 Constructor Semantics and Usage Examples

Manual super: Alternative Design where subclass constructors do not automatically call superclass constructors

This Gist presents a new design of class-based object construction in ES6 that does not require use of the two-phase @@create protocol.

One of the characteristics of this proposal is that subclass constructors must explicitly super invoke their superclass's constructor if they wish to use the base class' object allocation and initialization logic.

An alternative version of this design automatically invokes the base constructor in most situations.

@AgelxNash
AgelxNash / customRoute.plugin.php
Last active September 13, 2019 09:35
Плагин для кастомной маршрутизации в MODX Evolution + сниппет для формирования ссылок. Данная реализация работает только при кэше с учетом ID и $_GET
//<?php
/**
* Onetable Route
*
* Плагин для кастомной маршрутизации
*
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @author Agel_Nash <Agel_Nash@xaker.ru>
* @version 0.1
*
@turtlesoupy
turtlesoupy / nginx.conf
Created July 8, 2012 21:16
node.js upstream nginx config
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;