Skip to content

Instantly share code, notes, and snippets.

View shelooks16's full-sized avatar
🍌
Focusing

AndrewB shelooks16

🍌
Focusing
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active May 3, 2024 10:19
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@jalbam
jalbam / requestAnimationFrame-polyfill.js
Last active February 5, 2024 01:10
window.requestAnimationFrame polyfill (with high resolution timing, very precise)
'use strict';
// requestAnimationFrame polyfill by Erik Möller.
// Fixes from Paul Irish, Tino Zijdel, Andrew Mao, Klemen Slavic, Darius Bacon and Joan Alba Maldonado.
// Adapted from https://gist.github.com/paulirish/1579671 which derived from
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// Added high resolution timing. This window.performance.now() polyfill can be used: https://gist.github.com/jalbam/cc805ac3cfe14004ecdf323159ecf40e
// MIT license
// Gist: https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
@StarpTech
StarpTech / redis-cache-service.js
Last active April 15, 2021 16:26
Simple Redis Cache Client for Node.js
'use strict';
const assert = require('assert');
/**
* The redis client is https://github.com/luin/ioredis
*/
/*
const redisClient = new Redis({
@mrk-han
mrk-han / emulator-install-using-avdmanager.md
Last active May 1, 2024 21:12
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For an emulator that mimics a Pixel 5 Device with Google APIs and ARM architecture (for an M1/M2 Macbook):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-30;google_atd;arm64-v8a"

@maximkott
maximkott / mask.js
Last active April 15, 2024 20:43
mask a string in javascript
export const maskString = (
value: any,
mask: string,
maskPatterns: Record<string, RegExp | ((char: string) => boolean)>
) => {
value = value || '';
mask = mask || '';
maskPatterns = maskPatterns || {};
let maskedValue = '';
@ajaxray
ajaxray / firebase-online-user-count-example.md
Last active July 18, 2022 09:57
Keep list (and count) of online users in a Firebase web app - by isolated rooms or globally

Gathering.js - How to use

Keep list (and count) of online users in a Firebase web app - by isolated rooms or globally.

Live Demo

Firebase Shared Checklist is a demo application that shows the number of users joined a checklist using gathering.js. Here is a 1 minute screencast of using this application.