Skip to content

Instantly share code, notes, and snippets.

@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)
@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 / 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: ["┌", "─", "┐", "│", "┘", "─", "└", "│"],