Skip to content

Instantly share code, notes, and snippets.

Avatar
⚒️
No time for commit, just push!

Pavel Belousov pafnuty

⚒️
No time for commit, just push!
View GitHub Profile
View Crash.test.ts
process.env.TS_NODE_PROJECT = './tsconfig.json';
import * as moment from 'moment'
import * as mocha from 'mocha';
import { assert } from 'chai';
import axios from "axios";
@pafnuty
pafnuty / readme.md
Created Mar 14, 2022 — forked from glennschler/readme.md
AWS Docker VPN
View readme.md

Using AWS Linux setup an L2TP/IPSEC Soft Ether VPN

Consider HVM (SSD) EBS-Backed 64-bit m3.medium

  • us-east-1 => ami-1ecae776

  • Updates and dependencies

sudo yum -y update
sudo yum -y upgrade
sudo yum -y install docker git wget
@pafnuty
pafnuty / index.js
Created Aug 21, 2019
index.js for letu-write-version
View index.js
/**
* Create `version.json` and `buildHash`
*/
const path = require('path')
const git = require('git-rev-sync')
const fs = require('fs')
const dotenv = require('dotenv')
dotenv.config({silent: true})
@pafnuty
pafnuty / ko.utils.3.5.0.signatures.js
Created Jul 18, 2019 — forked from hyle/ko.utils.3.5.0.signatures.js
KnockoutJS 3.5.0 utils (ko.utils) signatures
View ko.utils.3.5.0.signatures.js
// knockout 3.5.0
ko.utils.addOrRemoveItem = function (array, value, included) { /* .. */ }
ko.utils.anyDomNodeIsAttachedToDocument = function (nodes) { /* .. */ }
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
@pafnuty
pafnuty / group-objects-by-property.md
Created May 16, 2019 — forked from JamieMason/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value
View group-objects-by-property.md

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
 return objectsByKeyValue;
View sll.json
{
"extends": "stylelint-config-standard",
"rules": {
"indentation": 2,
"string-quotes": "single",
"no-duplicate-selectors": true,
"color-hex-case": "lower",
"color-hex-length": "long",
"color-named": "never",
"selector-no-id": true,
@pafnuty
pafnuty / vds.menu.adclear.css
Created May 20, 2017
Убираем рекламу между строк на vds.menu
View vds.menu.adclear.css
.col-xs-12 div[style="position:relative; display:block;"] + .panel-info {
opacity: 0;
}
.panel > .table > tbody:first-child > tr:first-child td {
border-top: solid 1px #ddd;
}
.table-striped-active {
background: inherit;
}
@pafnuty
pafnuty / image_gallery.tpl
Last active Jan 28, 2017
Выводим галлерею изображений из допполя с именем gallery, типа галерея.
View image_gallery.tpl
@pafnuty
pafnuty / top-list.tpl
Created Aug 12, 2016
Строим многостраничный нумерованный список (топ новостей)
View top-list.tpl
{*
Пример демонстрирует способ, которым можно реализовать многостраничные нумерованные списки.
Бывает полезно при построении топов новостей.
*}
<div id="{$block_id}">
{$pages}
{*
@pafnuty
pafnuty / emath_all.tpl
Created Apr 24, 2016
Пример демонстрирует работу модификатора ematch_all в модуле BlockPro
View emath_all.tpl
{*
Пример демонстрирует работу модификатора ematch_all в модуле BlockPro
показано как можно посчитать количество картинок в новости.
*}
{foreach $list as $key => $el}
{* Счётчик гифок *}
{set $totalGifs = 0}
{* Счётчик остальных картинок *}