Skip to content

Instantly share code, notes, and snippets.

View mladenp's full-sized avatar

Mladen Petrović mladenp

View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active September 19, 2024 20:10
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@kamilogorek
kamilogorek / _screenshot.md
Last active September 18, 2024 03:05
Clutter-free VS Code Setup
image
@makella
makella / filters.md
Last active February 5, 2024 22:47
protomaps.js styling filters

A place to collect handy tips and tricks for style-based filters

Simple color by type

In this case, there are multiple types filtered from the same layer. I want to assign each type a unique color.

Try 1: fail

If/else conditions with a fallback. (following this example)

  {
    dataLayer: `admin`,
@benedictjohannes
benedictjohannes / CRASwitchEntryPointByEnv.js
Last active April 1, 2020 17:12
Workaround to enable switching main entry point of Create-React-App by .env
// package.json
{
//...
"scripts": {
"startfirst": "REACT_APP_MAIN_COMPONENT=FirstMainComponent react-scripts start",
"buildfrst": "REACT_APP_MAIN_COMPONENT=FirstMainComponent react-scripts build",
"startsecond": "REACT_APP_MAIN_COMPONENT=SecondMainComponent react-scripts start",
"buildsecond": "REACT_APP_MAIN_COMPONENT=SecondMainComponent react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
@mladenp
mladenp / WebStorm_JS_Code_Scheme.xml
Created August 6, 2019 10:41
WebStorm AirBnB CodeStyle Scheme
<code_scheme name="Airbnb">
<option name="RIGHT_MARGIN" value="100" />
<option name="HTML_ATTRIBUTE_WRAP" value="4" />
<option name="HTML_ELEMENTS_TO_INSERT_NEW_LINE_BEFORE" value="" />
<option name="HTML_ENFORCE_QUOTES" value="true" />
<DBN-PSQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
@mrstif
mrstif / postgis.md
Last active August 9, 2018 14:28
PostGis

https://postgis.net/docs/

SRIDs

3857 - Simple Spherical Mercator projection coordinate system
4326 - Geographic coordinate system

FUNCTIONS

  • ST_Transform: Return a new geometry with its coordinates transformed to a different spatial reference.
@helgatheviking
helgatheviking / add-taxonomy-to-woocommerce-export.php
Last active September 12, 2024 21:38
Add a custom taxonomy to WooCommerce import/export
<?php
/*
* Plugin Name: WooCommerce Add Taxonomy to Export
* Plugin URI: https://gist.github.com/helgatheviking/114c8df50cabb7119b3c895b1d854533/
* Description: Add a custom taxonomy to WooCommerce import/export.
* Version: 1.0.1
* Author: Kathy Darling
* Author URI: https://kathyisawesome.com/
*
* Woo: 18716:fbca839929aaddc78797a5b511c14da9
@grakic
grakic / ePorezi-macOS.md
Last active July 1, 2024 14:20
ePorezi na macOS

ePorezi na macOS

Zvanična klijentska aplikacija Poreske uprave se može preuzeti sa njihove stranice.

U pitanju je Java aplikacija koja dolazi sa posebno priređenom distribucijom Oracle Java radnog okruženja. Aplikacija podržava samo Microsoft Windows operativni sistem i sertifikatima u Personals skladištu pristupa kroz Microsoft CryptoAPI koji poziva operacije na pametnoj kartici ili tokenu posredstvom midlvera.

Sertifikaciono telo Pošte korisnicima nudi SafeSign midlver, osim u verziji za Windows i u verziji za GNU/Linux i macOS operativne sisteme. Midlver isporučuje prateću aplikaciju za upravljanje karticom/tokenom i PKCS#11 biblioteku. Programi poput jSignPDF, Adobe Reader ili LibreOffice mogu da učitaju ovu biblioteku i omoguće korisniku elektronsko potpisivanje dokumenata.

Elektronsko potpisivanje se koristi i na portalu ePorezi Poreske uprave, posredstvom pomenute klijentske aplikacije.

@fokusferit
fokusferit / enzyme_render_diffs.md
Last active June 18, 2024 11:27
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@acdlite
acdlite / app.js
Last active January 20, 2023 08:23
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {