Skip to content

Instantly share code, notes, and snippets.

View Stradivario's full-sized avatar
🌊
Riding the wave

Kristiqn Tachev Stradivario

🌊
Riding the wave
View GitHub Profile
@darconeous
darconeous / rect-starlink-cable-hack.md
Last active March 22, 2024 14:45
Hacking the Rectangular Starlink Dishy Cable
@Legioth
Legioth / examples.js
Created February 12, 2020 11:50
Stateful LitElement directive
import { html } from 'lit-element';
import { statefulDirective, StatefulLitElement } from './statefulDirective.js';
const simple = statefulDirective((param) => (part) => {
console.log("Activate simple", param, part);
part.setValue(param);
return () => console.log("Remove simple", param, part);
});
const withUpdate = statefulDirective((param) => (part) => {
@darionco
darionco / preHTML.ts
Last active December 19, 2020 03:42 — forked from AStaroverov/gist:56448f9baa560b4b7489ecf8ca0c36c8
preHTML - wrapper function fo dynamic tags lit-html
import {html, TemplateResult} from 'lit-element';
interface CachedNeedlessValue {
value: any;
index: number;
}
interface CachedTemplateStrings {
strings: string[];
needlessValues: CachedNeedlessValue[];
@AStaroverov
AStaroverov / gist:56448f9baa560b4b7489ecf8ca0c36c8
Created May 16, 2019 14:25
preHTML - wrapper function fo dynamic tags lit-html
import { html } from 'lit-element';
import { TemplateResult } from 'lit-html';
let str: string;
let valuesLength: number;
const cacheTemplateStringsToPreparedTemplateStrings = new WeakMap<TemplateStringsArray, string[]>();
const cacheTemplateStringsToNeedlessValuesIndexes = new WeakMap<TemplateStringsArray, number[]>();
// Сonvert dynamic tags to template strings
@jsdevtom
jsdevtom / frontend-ws-connection.ts
Last active April 17, 2024 07:35
kubernetes-ingress websockets with nodejs
export const ws = webSocket<WebsocketMessage>(`wss://${location.hostname}:${location.protocol === 'https:' ? 443 : 80}/ws/`);
export const wsObserver = ws
.pipe(
retryWhen(errors =>
errors.pipe(
delay(1000)
)
)
);
@outbounder
outbounder / organic-and-lean-software-development.md
Last active October 4, 2018 16:37
outlines rapid agile lean software development aimed to be optimized for change

Software development

In a nutshell it is just the following:

  1. got a task/requirements/problem which can be solved with a computer
  2. implement a solution
  3. see that solution actually works (most of the time)
  4. see that solution fails in some cases
  5. iterate from 2) to 5) until the original task/requirement/problem is resolved to its full extend
@utek
utek / wildcard-ssl-certificate.md
Created August 31, 2018 06:25 — forked from talyguryn/wildcard-ssl-certificate.md
How to get a wildcard ssl certificate and set up Nginx.

Request a new certificate

Get certbot

Go to any directory and clone repo with sources.

cd ~
git clone https://github.com/certbot/certbot
@zdrr
zdrr / flatDeep.ts
Last active November 26, 2019 21:43
interface IDocument {
id: number;
documents: IDocument[];
}
const DOCUMENTS: IDocument[] = [{
id: 100,
documents: [
{
id: 1,
@qkdreyer
qkdreyer / Y.js
Created June 9, 2018 12:55
ES6 Y Combinator One Liner
// http://kestas.kuliukas.com/YCombinatorExplained/
// https://rosettacode.org/wiki/Y_combinator#JavaScript
//
// const factorial = Y(next => (n) => {
// if (n < 2) return 1;
// return n * next(n - 1);
// });
// console.log(factorial(5)); // 120
const Y = f => (...args) => f(Y(f))(...args);
@claytongulick
claytongulick / template.js
Last active June 25, 2022 23:32
if statement inside string template literals and lit-html.
//a quick example of how to use actual 'if' statements inside template literals,
//without using ternary operator. Sometimes this is cleaner if you have complex conditionals or nested conditionals.
//data param is passed in via render(template(data), this) - if not using lit-html, could be any function
template = (data) => html`
<div id="job_edit" class="modal">
<div class="modal-content">
${
//we're just going to wrap an anonymous inline function here and then call it with some data
(job => { //job here, is just an example, it could be anything, it's passed in below in (data.job)
if(job)