Skip to content

Instantly share code, notes, and snippets.

Avatar
🕶️
Working hard

Lee Igor embarq

🕶️
Working hard
View GitHub Profile
View fullpage-scroller.js
// @ts-check
import { Subject, from, fromEvent, timer } from 'rxjs'
import { filter, throttle, map, switchMap, tap, first, takeUntil } from 'rxjs/operators'
import gsap from 'gsap'
import './style.css'
console.clear()
class Slider {
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>DOM task: Form model</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<style>
View bank_users.json
[
{
"id": "86837561-6718-4f43-9eb8-01176dbb1606",
"first-name": "Tedmund",
"last-name": "",
"email": "tfancourt0@home.pl",
"gender": "Male",
"iban": "FI21 1148 8020 1413 22",
"credit-card-type": "",
"credit-card": ""
View heroes.json
[{
"name": "Ancient One",
"species": "human",
"genger": "Female",
"birthDay": "1316",
"deathDay": "2017",
"status": "deceased",
"actors": "Tilda Swinton",
"photo": "https://vignette.wikia.nocookie.net/marvelcinematicuniverse/images/4/46/DS_Ancient_One_Poster_cropped.png",
"movies": ["Doctor Strange", "Avengers: Endgame"]
View index.js
// @ts-check
/**
* @param {Array<{ x: number, y: number }>} body snake body coords
* @param {{ x: number, y: number }} cell snake cell to check with
* @returns {{ x: number, y: number }} coords of the cell where collision occured(if any)
*/
function findCollision(body, cell) {
const { x: x1, y: y1 } = cell;
return body.find(({ x: x0, y: y0 }) => (x0 === x1 && y0 === y1));
@embarq
embarq / allow-ingress-multiple-ports.sh
Created Nov 28, 2019
GCloud Compute Engine: add multiple firewall rules for desired TCP ports
View allow-ingress-multiple-ports.sh
#!/bin/bash
BASE_RULE_NAME="rule-allow-tcp"
TARGET_NET_TAG="frontserver" # For more info see https://cloud.google.com/vpc/docs/add-remove-network-tags
for PORT in 4201 4202 4203 4204 4205 4206 4207 4208 4209
do
# See reference https://cloud.google.com/vpc/docs/using-firewalls
gcloud compute firewall-rules create $BASE_RULE_NAME-$PORT \
--source-ranges 0.0.0.0/0 \
--allow tcp:$PORT \
@embarq
embarq / README.md
Last active Nov 29, 2019
Remote development with VSCode & GCloud Compute Engine
View README.md

Set up GCloud Compute Instance

  1. Create instance
  2. Create ssh key for remote host access locally: ssh-keygen -t rsa -C {host_username}
  3. Add ssh public keys to .ssh/authorized_keys on the host side
  4. Connect to host via ssh {host_username}@{host_ip}

If you want to use a specific port for local preview it needs to be available by setting up a firewall rule:

  1. Create new rule for a tag:
View temp.md

Variables

  1. Immutable data-manipulations
// Instead of

const data = [ /*  */ ];
data.push(100, 200, 300);
@embarq
embarq / settings.json
Created Aug 30, 2019
VSCode settings
View settings.json
{
"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",
View items-parser.js
/**
* 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()) {