Skip to content

Instantly share code, notes, and snippets.

View abdellatifLabr's full-sized avatar
💪
Improving

Abdellatif Labreche abdellatifLabr

💪
Improving
View GitHub Profile
@abdellatifLabr
abdellatifLabr / broadcast-channel.md
Created November 25, 2023 10:49 — forked from davestewart/broadcast-channel.md
Example of using BroadcastChannel to communicate with pages in the same domain
@abdellatifLabr
abdellatifLabr / configuration.md
Last active April 19, 2021 13:30
Python Django formatting and linting configuration
View configuration.md

Isort

[settings]
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
multi_line_output = 3
include_trailing_comma = true
skip_gitignore = true

Pylint

View react-eslint-setup.md

React eslint setup

$ npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-config-airbnb eslint-plugin-html @trivago/prettier-plugin-sort-imports

.eslintrc

{
  "env": {
    "browser": true
 },
@abdellatifLabr
abdellatifLabr / Lite.psm1
Created August 29, 2020 14:37
Powershell 7 oh-my-posh Lite theme
View Lite.psm1
#requires -Version 2 -Modules posh-git
function Write-Theme {
param(
[bool]
$lastCommandFailed,
[string]
$with
)
@abdellatifLabr
abdellatifLabr / light-or-dark.js
Last active May 16, 2019 14:39
Find out if a color is light or dark.
View light-or-dark.js
function lightOrDark(color) {
let r, g, b, hsp;
color = parseInt(
'0x' + color.slice(1, color.length - 2).replace( color.length < 5 && /./g, '$&$&')
);
r = color >> 16;
g = color >> 8 & 255;
b = color & 255;
hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
return hsp > 127.5 ? 'light' : 'dark';