Skip to content

Instantly share code, notes, and snippets.

View rohmanhm's full-sized avatar
💪
yes

Rohman HM rohmanhm

💪
yes
View GitHub Profile
// 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 / 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.
@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 / puppeteer.d.ts
Last active February 7, 2023 12:10
Puppeteer Definition Types for Typescript
declare module 'puppeteer' {
export interface ConnectOptions {
browserWSEndpoint?: string
// a browser websocket endpoint to connect to
ignoreHTTPSErrors?: boolean
// Whether to ignore HTTPS errors during navigation. Defaults to `false`
}
export interface LaunchOptions {
ignoreHTTPSErrors?: boolean
(id=".[^\"]*")
Demo
https://regex101.com/r/5u1Yo6/1
@rohmanhm
rohmanhm / gh-pages-deploy.md
Created May 31, 2017 07:31 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@rohmanhm
rohmanhm / computedStyleToObject.js
Created May 19, 2017 06:48
computedStyle to object
function serializeComputedStyle (computed) {
const result = {}
Object.keys(computed).forEach(key => {
if (!Number(key) && !(Number(key) <= 0)) {
result[key] = computed[key]
}
})
return result
}
@rohmanhm
rohmanhm / sequelize.flow.js
Created May 7, 2017 01:28
sequelize flow-typed
/**
* Flowtype definitions for index
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.2.0
* Author: [Joar Wilk](http://twitter.com/joarwilk)
* Repo: http://github.com/joarwilk/flowgen
*/
/**