Skip to content

Instantly share code, notes, and snippets.

View lacikawiz's full-sized avatar
🏠
Working from home

Laszlo Szenes lacikawiz

🏠
Working from home
View GitHub Profile
@lacikawiz
lacikawiz / *Svelte App or Module Starter Template.md
Last active November 9, 2018 14:54
Svelte App/Component Starter Template

Svelte App or Module Starter Template

This is a template to start an app or component. It contains all the commonly used elements with comments explaining what the elements are. These can, of course, be removed.

Based on the Svelte guide: https://svelte.technology/guide

@lacikawiz
lacikawiz / *<Modal> Svelte Module: Modal Window with content insertion.md
Last active November 9, 2018 14:48
<Modal> Svelte Module: Modal Window with content insertion
@lacikawiz
lacikawiz / *<Money> Svelte Component: auto-formatting number input for number entering.md
Last active May 23, 2021 19:58
<Money> Svelte Component: auto-formatting number input for number entering
@lacikawiz
lacikawiz / *Svelte Component: <Section> (styled).md
Last active November 9, 2018 14:57
A styled `Section` with slots for Title, Header, Content & Footer
@lacikawiz
lacikawiz / *<FixedBottom> Svelte Component.md
Last active November 9, 2018 19:57
<FixedBottom> Svelte Component: Generates an always visible content on the bottom of the page
@lacikawiz
lacikawiz / *<InputBlock> Svelte Component: A block to display all necessary elements to an input.md
Last active November 10, 2018 14:33
<InputBlock> Svelte Component: A block to display all necessary elements to an input

<InputBlock> component

An <InputBlock> is a unit that contains all the necessary elements for a form input element.

  • The label (with indication whether it's a required field)
  • The input component itself
  • The Explanation (short note or explanantion on the what needs to be inputted)

It also handles the validation (as given by a parameter) and displaying an error message if there's one.

@lacikawiz
lacikawiz / *Vanilla JS Wait for elements to appear in DOM.md
Created January 6, 2019 23:23
Vanilla JS Wait for elements to appear in DOM

Run JS code on DOM elements as soon as they appear

This code is written to handle cases when the DOM is being generated, like Angular, Ractive or Svelte, etc. It does a quick (100ms) repeated check for the existence of the DOM elements and when they appear it runs the given function on each elements.

@lacikawiz
lacikawiz / *Calculate Circle from Points.md
Created January 13, 2019 18:16
Calculate center coordinates and radius of circle based on the coordinates of 3 points on the circumference

#How to find the parameters of a circle based on 3 points on circumference

I spent some hours with WolframAlpha, paper and a text editor to distill the mathematical formula to find the center coordinates of a circle and its radius. I tested it with a few random coordinates and it returned precise results each time.

I provide here a Go code for my testing. It's very trivial to convert it into any other language.

Laszlo

@lacikawiz
lacikawiz / google-translate.js
Last active November 19, 2019 09:34
Calling Google Translate from JS, no API Key needed
/*
Calling of simple Google API to translate short pieces of text.
Requires no API key :)
WARNING: This call has a severe rate limitation. Frequent calls will result in a temporary block for your IP address for a few hours.
INPUT:
- source language code, eg: "ru"
- target language code, eg: "en"
- text to be translated
@lacikawiz
lacikawiz / Svelte Components Collection.md
Last active April 8, 2021 14:47
Svelte Components Collection