Skip to content

Instantly share code, notes, and snippets.

View vanchelo's full-sized avatar
💭
Life is good

Brezhniev Ivan vanchelo

💭
Life is good
View GitHub Profile
@vanchelo
vanchelo / keymap.txt
Last active April 8, 2023 15:17 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@vanchelo
vanchelo / mark-control-and-update.ts
Created August 14, 2020 14:02 — forked from MarsiBarsi/mark-control-and-update.ts
Mark control and update validity function
import {AbstractControl, FormArray, FormGroup} from '@angular/forms';
export function markControlAsTouchedAndValidate(control: AbstractControl) {
if (control instanceof FormArray) {
control.controls.forEach(nestedControl => {
markControlAsTouchedAndValidate(nestedControl);
});
return;
}
<!-- Prevent FOUC (flash of unstyled content) - http://johnpolacek.com/2012/10/03/help-prevent-fouc/ -->
<style type="text/css">
.no-fouc {display: none;}
</style>
<script type="text/javascript">
document.documentElement.className = 'no-fouc';
// add to document ready: $('.no-fouc').removeClass('no-fouc');
</script>
@vanchelo
vanchelo / Тестирование.md
Created September 7, 2018 19:00 — forked from codedokode/Тестирование.md
Автоматизированное тестирование

Автоматизированное тестирование

Если ты пишешь код, то наверняка его тестируешь. Если речь о какой-то функции, то ты можешь вызывать ее с разными аргументами, и смотреть, что она вернет. Если ты сверстал сайт, то ты открываешь его в браузере, жмешь ссылки и кнопки, проверяешь что все сделано верно. Это называется ручное тестирование — человек проверяет работу программы. Нельзя ли эту задачу переложить на плечи роботов? Обычно можно, и это называется автоматизированное тестирование.

Тестирование позволяет сделать твой код надежнее, а твою жизнь проще. Ведь согласись, лучше когда ты сам обнаруживаешь и исправляешь ошибку до релиза, чем когда рассерженный заказчик звонит на выходных и требует срочно исправить неработающий функционал.

Тестирование особенно полезно при разработке больших приложений в большой команде, когда ты можешь нечаянно сломать какую-то функцию, которую делал другой человек, и о которой ты не знал. Или когда надо доработать написанный ранее сложный проект.

В больших компаниях может быт

@vanchelo
vanchelo / action.js
Created May 17, 2018 12:21 — forked from benpickles/action.js
Inject an Authorization header into a redux-api-middleware request with a Redux middleware.
import { CALL_API } from 'redux-api-middleware'
export function fetchLocations() {
return {
[CALL_API]: {
endpoint: 'http://api.somesite.com/api/locations',
method: 'GET',
// Don't have to manually add the Authorization header to every request.
headers: { 'Content-Type': 'application/json' },
types: ['REQUEST', 'SUCCESS', 'FAILURE']
@vanchelo
vanchelo / letsencrypt_2017.md
Created September 2, 2017 20:27 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

<?php
namespace App\Services\Foundation;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Support\Jsonable;
use InvalidArgumentException;
use JsonSerializable;
class JsonFactory
@vanchelo
vanchelo / Socket.js
Created January 16, 2017 15:53 — forked from iximiuz/Socket.js
AngularJS namespaced socket.io service concept
'use strict';
/**
* Пример использования socket.io namespaces в сервисе AngularJS.
*
* Цель: получить несколько отдельных каналов связи в рамках одного соединения.
*
* Проблема: так как сервисы в AngularJS являются синглтонами, не возможно
* получить несколько экземпляров сервиса Socket с разными значениями
* namespace. При этом хочется иметь отдельные сервисы, представляющие

SSL upgrades on rubygems.org and RubyInstaller versions

UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.


Hello,

If you reached this page, means you've hit this SSL error when trying to

<?php
<<<CONFIG
packages:
- "lavoiesl/php-benchmark: dev-master"
CONFIG;
/**
* run command "melody run https://gist.githubusercontent.com/vanchelo/4e6476b52fa6fc665b0b/raw/f965054e77d7c431fdfb25ad096e378a3fb1a52f/speedtest.php -vvv"
*/