Skip to content

Instantly share code, notes, and snippets.

View m-esm's full-sized avatar
https://calendly.com/m-esm/coffee-chat

Mohsen Esmaeili m-esm

https://calendly.com/m-esm/coffee-chat
View GitHub Profile
@m-esm
m-esm / gist:5abe07930a31975abd5610e5844e5fea
Created January 23, 2021 19:09
bolt_tech_interview_2.js
/**
Imagine some photo file names with lowercase letters and/or digits. We want to sort them as a human would consider natural with a function with the following signature.
// return 0 if a = b, <0 if a < b, >0 if a > b
function compareNaturally(a: string, b: string): number {
//TODO implement
}
@m-esm
m-esm / whitespace-challenge.md
Created May 17, 2022 10:48
Whitespace coding challenge

We have a list of valid words, and a long string of text without whitespace. All characters are UTF8, a-z.

Please write a function that finds if the string can be composed of valid words, and if so, adds whitespace between them. Not all words have to be used, but words can be used multiple times. If it's not possible, return empty string and a descriptive error.

The words on validWords do not overlap.

func addWhitespace(input string, validWords []string) (string, error)
@m-esm
m-esm / code-node.js
Last active July 16, 2023 01:34
embassy-appointment-n8n
const vision = require("@google-cloud/vision");
const puppeteer = require("puppeteer");
const fs = require("fs-extra");
const URL = "https://YOUR_EMBASSY_URL_AND_THE_PAGE";
const browser = await puppeteer.connect({
browserWSEndpoint: `ws://browserless:3000?token=TOKEN_HERE`,
args: [`--window-size=1024,860`],
defaultViewport: {
@m-esm
m-esm / extract_tweets.js
Last active February 26, 2025 05:08
Extract tweets from browser
if (!window.tweets) window.tweets = {};
/**
* @param tweetElem {HTMLElement}
*/
window.parseTweetElement = (tweetElem) => {
const isQuote = !!Array.from(tweetElem.querySelectorAll("span")).find(
(p) => p.textContent === "Quote"
);
@m-esm
m-esm / README.md
Created April 29, 2024 21:22 — forked from serdaradali/README.md
Interactive world globe

Zoomable/rotatable world globe that uses orthographic projection. Drag behavior is enhanced as described here: https://www.jasondavies.com/maps/rotate/

Performance is not good due to redrawing whole world upon zoom/drag.