Skip to content

Instantly share code, notes, and snippets.

@drhisham-code
drhisham-code / render-state.ts
Created November 16, 2020 11:40 — forked from steveruizok/render-state.js
Render a State Designer state in the terminal.
import log from "ololog"
class Grid {
rows = []
width = 0
height = 0
chars = {
active: ["┌", "─", "┒", "┃", "┛", "━", "┕", "│"],
inactive: ["┌", "─", "┐", "│", "┘", "─", "└", "│"],
@drhisham-code
drhisham-code / image_downloader.js
Created October 23, 2020 09:55 — forked from sfrdmn/image_downloader.js
Bookmarklet to download all images on a page
;(function() {
var images = [].slice.call(document.querySelectorAll('img'))
try {
images.forEach(function(img) {
downloadImage(img)
})
} catch (e) {
alert("Download failed.");
console.log('Download failed.', e);
}
@drhisham-code
drhisham-code / filter truthy values in javascript
Created July 30, 2020 20:49
filter js array to only truthy values
let truthyAndFalsy = [4, 56, 78, 99, 101, 150, 299, 300,"",undefined];
let onlyTruthy =truthyAndFalsy.filter(number => Boolean(number));
console.log(onlyTruthy)
//Assuming that our URL is https://example.com/?product=shirt&color=blue&newuser&size=m,
//we can grab the query string using window.location.search:
const queryString = window.location.search;
// console.log(queryString);
// ?product=shirt&color=blue&newuser&size=m
//We can then parse the query string’s parameters using URLSearchParams:
const urlParams = new URLSearchParams(queryString);
@drhisham-code
drhisham-code / auto increment column with header row in google sheets
Created July 29, 2020 19:45
auto increment column with header row in google sheets
= ArrayFormula(
IF(ROW(B:B)=1,"ID",
IF(ISBLANK(B:B),"",
row(B:B)-1
)
)
)
// A:A is the ID column that will autoincrement
// B:B is the adjacent column that is checked for blank
@drhisham-code
drhisham-code / easings.css
Created July 24, 2020 09:24 — forked from argyleink/easings.css
Handy CSS properties for easing functions
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

/*
It's now a package. You can find it here:
https://github.com/joshnuss/svelte-local-storage-store
*/
// Svelte store backed by window.localStorage
// Persists store's data locally
@drhisham-code
drhisham-code / karabiner.edn
Created June 3, 2020 01:23
mouse karabiner
{:main [{:des "mb3-layer"
:rules [
;; set the action for double press first
[{:pkey :button3} [:!Sgrave_accent_and_tilde :slash ] ["mb3-q" 1] ]
;; set the variable initializer for single press,longpress and allow pass throw on doublepress ?
;;[{:pkey :button3} [["mb3-layer" 1]["mb3-q" 1]{:pkey :button3}] nil
[{:pkey :button3} [["mb3-layer" 1]["mb3-q" 1]] nil
{:afterup ["mb3-layer" 0]
:alone {:pkey :button3}
:delayed {:invoked ["mb3-q" 0] :canceled ["mb3-q" 0]}
@drhisham-code
drhisham-code / karabiner.edn
Created June 3, 2020 00:45
mouse key rmap for double press and layer
{:main [{:des "mb3-layer"
:rules [
;; set the action for double press first
[{:pkey :button3} [:!Sgrave_accent_and_tilde :slash ] ["mb3-q" 1] ]
;; set the variable initializer for single press and allow pass throw?
[{:pkey :button3} [["mb3-layer" 1]["mb3-q" 1]{:pkey :button3}] nil
{:afterup ["mb3-layer" 0]
:alone {:pkey :button3}
:delayed {:invoked ["mb3-q" 0] :canceled ["mb3-q" 0]}
}]