Skip to content

Instantly share code, notes, and snippets.

View kuncevic's full-sized avatar
🎯
Focusing

Aliaksei Kuncevič kuncevic

🎯
Focusing
View GitHub Profile
@kuncevic
kuncevic / zeit-now-g-suite-setup.md
Last active December 21, 2020 01:51 — forked from jaydenseric/zeit-now-g-suite-setup.md
Zeit Now G Suite setup

Run each of the following lines, replacing yourdomain.com and codehere with your details:

vc dns add yourdomain.com @ TXT google-site-verification=codehere
vc dns add yourdomain.com @ MX ASPMX.L.GOOGLE.COM 1
vc dns add yourdomain.com @ MX ALT1.ASPMX.L.GOOGLE.COM 5
vc dns add yourdomain.com @ MX ALT2.ASPMX.L.GOOGLE.COM 5
vc dns add yourdomain.com @ MX ALT3.ASPMX.L.GOOGLE.COM 10
vc dns add yourdomain.com @ MX ALT4.ASPMX.L.GOOGLE.COM 10
import { BehaviorSubject, of } from 'rxjs';
import { distinctUntilChanged, concatMap, map, take } from 'rxjs/operators';
export class StateDef<T> extends BehaviorSubject<T> {
setState(setter: (state: T) => T) {
this.pipe(take(1)).subscribe(state => {
super.next(setter(state));
});
}
@kuncevic
kuncevic / jQuery API Call Utility
Created March 12, 2018 08:57
jQuery API Call Utility
var Service = (function () {
Service.prototype.Call = function (input) {
var output = new dataOut(42);
if (!input.url) output.status = "url is undefined";
if (!input.data) output.status = "data is undefined";
if (output.status != 42)
return output;
import { Input } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
export function InputObservable<T>(inputName?: string) {
return (target: object, name: string): void => {
const subject = new BehaviorSubject(this[name]);
if (delete target[name]) {
Object.defineProperty(target, name, {
set(value: T): void {
@kuncevic
kuncevic / sample.html
Created January 22, 2018 22:28 — forked from guillaumegarcia13/sample.html
Angular 4 ng-template & ng-container with parameters
<ng-template #followingpost let-author="author" let-age="age" let-text="text" let-badge="badge">
<div class="container-fluid">
<div class="card">
<div class="header">
<h4 class="title">{{ author }}</h4>
<p class="category">il y a {{ age }} jours</p>
</div>
<div class="content" [innerHTML]="text">
</div>
@kuncevic
kuncevic / git_cheat_sheet.txt
Last active May 22, 2018 06:33
git cheat sheet
git config --get remote.origin.url
git remote show origin
git ls-remote --get-url
git add -A //stages All
git add . //stages new and modified, without deleted
git add -u //stages modified and deleted, without new
git reset -- main/dontcheckmein.txt
@kuncevic
kuncevic / CookieManager.ts
Created September 27, 2017 04:06
aspnet core cooke manager, cookie helper
public class CookieManager
{
private readonly IHttpContextAccessor httpContextAccessor;
private readonly IDataProtector protecotr;
public CookieManager(IHttpContextAccessor httpContextAccessor, IDataProtectionProvider provider)
{
this.httpContextAccessor = httpContextAccessor;
this.protecotr = provider.CreateProtector(GetType().FullName);
}