Skip to content

Instantly share code, notes, and snippets.

View embarq's full-sized avatar
🕶️
Working hard

Li Ihor embarq

🕶️
Working hard
View GitHub Profile
@embarq
embarq / settings.json
Created August 30, 2019 10:55
VSCode settings
{
"diffEditor.ignoreTrimWhitespace": true,
"editor.cursorBlinking": "phase",
"editor.cursorStyle": "line",
"editor.dragAndDrop": false,
"editor.fontFamily": "Menlo, monospace",
"editor.formatOnPaste": false,
"editor.multiCursorModifier": "ctrlCmd",
"editor.renderControlCharacters": true,
"editor.snippetSuggestions": "top",
@embarq
embarq / set-date.ts
Created March 27, 2017 12:52
Example for setting date under datepicker via rxjs
if (this.element.nativeElement instanceof HTMLInputElement) {
const dateRegex = /\d{2}\/\d{2}\/\d{4}/;
Observable
.fromEvent(this.element.nativeElement, 'keyup')
.debounceTime(250)
.filter((event: KeyboardEvent) => this.allowedKeys
.indexOf(event.key.toLowerCase()) !== -1)
.map((event: KeyboardEvent) => (event.target as HTMLInputElement).value)
.filter((query: string) => dateRegex.test(query))
@embarq
embarq / remove.sh
Created July 3, 2017 11:29
Remove all files with specific extension in special dir
find ./src/app -name \"*.js\" -type f -delete
/**
* Items parser
* ---
* https://liquipedia.net/dota2/Portal:Items
*/
var data = [];
var itemsNodes = document.querySelector('.mw-parser-output').querySelectorAll('div.responsive');
for (let item of itemsNodes.values()) {
export const HallOfFame = (function() {
/** @argument {Array<any>} players */
const sortPlayers = (players) => {
return players.slice().sort((a, b) => {
if (a.length !== 2 || b.length !== 2) {
console.log('[sortPlayers:except]', a, b);
return -1;
}
@embarq
embarq / form-control.txt
Created July 24, 2017 14:34
Emmet snippet for bootstrap form-controls
fieldset.form-group.row*7>.col-sm-4>label[for=$]{$}.control-label^+.col-sm-8>input.form-control[id=$ name=$]
@embarq
embarq / angular-styleguide.md
Last active November 23, 2018 09:24
Angular Styleguide

Angular Styleguide

This document is the extension of the original Angular Styleguide and overrides some original rules. Must be applied in common.

Components

  1. Imports must be at the beginning of a source file and must keep the following order:
    1. Angular libraries
    2. Angular-related vendor libraries
  2. Other vendor libraries
const title = document.querySelector<HTMLElement>('.toolbar-content-stub');
const toolbar = document.querySelector<HTMLElement>('.header-footer');
const transformState = toolbar.style.transform.match(/matrix\(([\d\,\s\.\-]+)\)/);
if (transformState == null || (Array.isArray(transformState) && transformState.length < 2)) {
console.warn('[LoginPage.resetToolbarTransform]: Unrecognized transform value, doing nothing', toolbar.style.transform);
return;
}
try {
const path = require('path');
const fs = require('fs');
const qs = require("querystring");
const http = require("https");
const { exec } = require('child_process');
const { promisify } = require('util');
const stackblitz = require('@stackblitz/sdk');
const execAsync = promisify(exec);
const readFileAsync = promisify(fs.readFile);
@embarq
embarq / ionic.scss
Created September 3, 2018 14:11
Fix tappable on ion-input
ion-input:not(.cloned-input) {
pointer-events: initial !important;
}
.ghost-field.cloned-input input {
opacity: 0;
}
.ghost-field:not(.cloned-input) input {
opacity: 1 !important;