Skip to content

Instantly share code, notes, and snippets.

View rohmanhm's full-sized avatar
💪
yes

Rohman HM rohmanhm

💪
yes
View GitHub Profile
@rohmanhm
rohmanhm / format-currency.d.ts
Created October 5, 2018 13:09
Typescript definition for format-currency
declare module 'format-currency' {
interface Options {
format?: string; // %s => symbol, %v => value, %c => code
code?: string;
symbol?: string;
locale?: string;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
nanZero?: boolean;
}
@rohmanhm
rohmanhm / registerServiceWorker.ts
Created October 13, 2018 05:52
compatible with tslint-config-standard
// tslint:disable:no-console
// In production, we register a service worker to serve assets from local cache.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on the 'N+1' visit to a page, since previously
// cached resources are updated in the background.
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
// This link also includes instructions on opting out of this behavior.
// Type definitions for get-port 4.0
// Project: https://github.com/sindresorhus/get-port
// Definitions by: York Yao <https://github.com/plantain-00>
// BendingBender <https://github.com/BendingBender>
// MH Rohman <https://github.com/rohmanhm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'get-port' {
type Options = {
port?: number | ReadonlyArray<number>;
@rohmanhm
rohmanhm / cloudSettings
Last active April 10, 2020 07:44
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-04-10T07:44:40.507Z","extensionVersion":"v3.4.3"}
Verifying my Blockstack ID is secured with the address 1G5KphvEmgjn8TUACct2BNdr4Sj7XhpyD https://explorer.blockstack.org/address/1G5KphvEmgjn8TUACct2BNdr4Sj7XhpyD
@rohmanhm
rohmanhm / index.html
Last active February 18, 2020 09:59
Declare new variable #jsbench #jsperf (http://jsbench.github.io/#b8d1826a76310d767596f59d4dd25ce2) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Declare new variable #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
/((https?):\/\/)?(www.)?[a-z0-9]+(\.[a-z0-9]{1,}){1,3}(:[0-9])?(#?\/?[a-zA-Z0-9#_-]+)*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?.*)?$/gm
@rohmanhm
rohmanhm / disable-web-security
Created October 27, 2021 11:12 — forked from yimity/disable-web-security
disable-web-security
open -a "Google Chrome" --args --disable-web-security --user-data-dir
open -a "Microsoft Edge" --args --disable-web-security --user-data-dir
export function downloadFileFromBlob(fileName: string, blob: Blob) {
const url = window?.URL?.createObjectURL(blob);
const link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
setTimeout(() => {
document.body.removeChild(link);

Refactor from

const CustomLink: React.PropsWithChildren<CustomLinkProps> = ({
  href,
  as,
  className,
  children,
  style = {},
  ...props
}) => {