Skip to content

Instantly share code, notes, and snippets.

View danBamikiya's full-sized avatar
:octocat:
call me a sci-tech engineer

Dan Bamikiya danBamikiya

:octocat:
call me a sci-tech engineer
View GitHub Profile
@andrewsantarin
andrewsantarin / react-intl-tel-input TypeScript Drop-In Support.md
Last active January 31, 2022 00:48
Drop-in TypeScript support for the 'react-intl-tel-input' module
@Danziger
Danziger / interval.hook.ts
Last active November 15, 2023 18:00
✨ Declarative useTimeout (setTimeout), useInterval (setInterval) and useThrottledCallback (useCallback combined with setTimeout) hooks for React (in Typescript)
import React, { useEffect, useRef } from 'react';
/**
* Use setInterval with Hooks in a declarative way.
*
* @see https://stackoverflow.com/a/59274004/3723993
* @see https://overreacted.io/making-setinterval-declarative-with-react-hooks/
*/
export function useInterval(
callback: React.EffectCallback,
@paulirish
paulirish / asciiify-the-canvas.js
Last active January 4, 2025 15:03
ascii rendering of a canvas
// works great on about:dino
// 1. save this file to your snippets.
// 2. load about:dino
// 3. evaluate the snippet
// 4. hit up arrow to trigger the game.
// 5. profit
(function() {
perfnow = performance.now;
@addyosmani
addyosmani / lazyload.html
Last active November 8, 2022 11:00
Native image lazy-loading with a cross-browser fallback
<img data-src="unicorn.jpg" loading="lazy" alt=".." class="lazyload"/>
<script>
// Select all images with the class "lazyload"
const images = document.querySelectorAll("img.lazyload");
// Check if the browser supports the "loading" attribute
if ('loading' in HTMLImageElement.prototype) {
// If so, we'll update all <img src> to point to the data-src instead
images.forEach(img => {
img.src = img.dataset.src;
@unrevised6419
unrevised6419 / oss-tools.md
Last active August 8, 2024 00:19
Open source software tools
Set-Alias less "C:\Program Files\Git\usr\bin\less.exe"
function f($text, $files="*.*")
{
findstr /spin $text $files | less
}
@fnky
fnky / ANSI.md
Last active May 21, 2025 18:57
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@peterpham
peterpham / gist:898c0c64abcbaa427945fd8a4b4b6559
Created October 22, 2018 06:04
Useful command: check running processes
# list all listening ports
sudo lsof -i -P | grep -i "listen"
# list all processes using specific port - this will list all pid that using port 8080
lsof -i :8080 | grep "LISTEN"
# tell which application is running on specfic pid (for example, 1237)
ps -ef | grep 12337
# kill processes using port 8888
@Injectable({providedIn: 'root'})
export class ExternalUrlService implements CanActivate {
canActivate({ data }: ActivatedRouteSnapshot): boolean {
window.open(data.externalUrl, '_blank');
return false;
}
}