Skip to content

Instantly share code, notes, and snippets.

View akolybelnikov's full-sized avatar
:octocat:
Code weaves a story, Of logic and creativity, Developer's art form.

andrei akolybelnikov

:octocat:
Code weaves a story, Of logic and creativity, Developer's art form.
  • Shell
  • Amsterdam, Netherlands
  • 20:11 (UTC +02:00)
  • X @rokkapi
View GitHub Profile
@akolybelnikov
akolybelnikov / any.component.html
Created July 6, 2018 17:21 — forked from arniebradfo/any.component.html
Angular *ngFor recursive list tree template
<h1>Angular 2 Recursive List</h1>
<ul>
<ng-template #recursiveList let-list>
<li *ngFor="let item of list">
{{item.title}}
<ul *ngIf="item.children.length > 0">
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: item.children }"></ng-container>
</ul>
</li>
</ng-template>
@akolybelnikov
akolybelnikov / .bashrc
Last active April 21, 2020 12:47 — forked from pavbsu/.bashrc
Git Bash aliases for Windows
# create a file C:\Users\[user]\.bashrc
# add this content
# add your own aliases or changes these ones as you like
# to make a dot (.bashrs) file in windows, create a file ".bashrs." (without extention) and save. windows will save it as ".bashrc"
# run `source ~/.bashrc` in console
alias la='ls -A'
alias l='ls -CF'
alias gs='git status -bsu'
@akolybelnikov
akolybelnikov / localStorageMock.ts
Created September 5, 2018 13:48 — forked from wzr1337/localStorageMock.ts
Mock localStorage for jasmine tests in TypeScript. This is the testing script. Copy the parts between snip and snap to mock your localStorage
/// <reference path="../../library.test.d.ts"/>
import * as angular from "angular"; angular;
import * as mocks from "angular-mocks/ngMock"; mocks;
describe('feat(localStorage Mock): ', function() {
beforeAll(() => {
angular.module('mock-module',[])
});
@akolybelnikov
akolybelnikov / match-media.js
Created December 4, 2018 07:50 — forked from aliakakis/match-media.js
React based
/*
## Example ##
<MatchMedia mediaWidth={["(min-width: 768px)", "(min-width: 1280px)"]}>
<Checkbox
id="check_1"
label="Hello World!"
checked={isChecked}
onChange={() => this.setState({ isChecked: !isChecked })}
@akolybelnikov
akolybelnikov / hmac_sha1.py
Created January 29, 2019 19:48 — forked from heskyji/hmac_sha1.py
Generate HMAC-SHA1 Signature using Python 3
import hashlib
import hmac
import base64
def make_digest(message, key):
key = bytes(key, 'UTF-8')
message = bytes(message, 'UTF-8')
@akolybelnikov
akolybelnikov / date-fns-date-adapter.ts
Created February 25, 2019 17:13 — forked from JoniJnm/date-fns-date-adapter.ts
date-fns angular material adapter
import {Injectable} from '@angular/core';
import {DateAdapter} from '@angular/material';
import {addDays, addMonths, addYears, format, getDate, getDaysInMonth, getMonth, getYear, parse, setDay, setMonth, toDate} from 'date-fns';
// CONFIG. Use environment or something for a dynamic locale and settings
import {es as locale} from 'date-fns/locale';
const WEEK_STARTS_ON = 1; // 0 sunday, 1 monday...
export const MAT_DATE_FNS_DATE_FORMATS = {
@akolybelnikov
akolybelnikov / rename.js
Created May 26, 2019 22:01 — forked from scriptex/rename.js
Rename all files in a folder with NodeJS
const { join } = require('path');
const { readdirSync, renameSync } = require('fs');
const [dir, search, replace] = process.argv.slice(2);
const match = RegExp(search, 'g');
const files = readdirSync(dir);
files
.filter(file => file.match(match))
.forEach(file => {
const filePath = join(dir, file);
@akolybelnikov
akolybelnikov / git-overwrite-branch.sh
Created July 10, 2019 13:12 — forked from ummahusla/git-overwrite-branch.sh
Git overwrite branch with another branch
# overwrite master with contents of seotweaks branch (seotweaks > master)
git checkout seotweaks # source name
git merge -s ours master # target name
git checkout master # target name
git merge seotweaks # source name
Description: fix incorrect function parsing
Author: Chet Ramey <chet.ramey@case.edu>
Index: bash-4.2/bash/builtins/common.h
===================================================================
--- bash-4.2.orig/bash/builtins/common.h 2010-05-30 18:31:51.000000000 -0400
+++ bash-4.2/bash/builtins/common.h 2014-09-22 15:30:40.372413446 -0400
@@ -35,6 +35,8 @@
#define SEVAL_NOLONGJMP 0x040
@akolybelnikov
akolybelnikov / find-words.lisp
Created September 2, 2019 16:39 — forked from vseloved/find-words.lisp
splitting text w/o spaces into words
(ql:quickload :cl-ppcre)
(ql:quickload :rutils)
(use-package :rutil)
(named-readtables:in-readtable rutils-readtable)
(defpar *orig*
#/I joined Hacker News around 5 years ago. I used to wake up and do the grim commute each morning to London from my home and the only thing that made it vaguely ok was Hacker News. It was a great place to go and find interesting articles from genuinely passionate people. It also used to be a really safe place to launch a startup that you'd spent days, weeks, years on - your project. It was a place where you could launch your startup and know you'd get great constructive feedback. People may not necessarily like your site but they'd admire you for having the balls to launch it, for spending time developing something that you hoped could benefit people in some way. They'd want you to succeed and they'd try and help you succeed with feedback that would ultimately help you. Unfortunately, today's Hacker News audience is no longer the same. Today's Hacker News is a place where us