Skip to content

Instantly share code, notes, and snippets.

View rohit-gohri's full-sized avatar
🗯️
....

Rohit Gohri rohit-gohri

🗯️
....
View GitHub Profile
@rohit-gohri
rohit-gohri / v8Coverage.js
Created April 13, 2022 04:50
Get runtime coverage from V8 in istanbul format
/* eslint-disable global-require, import/no-extraneous-dependencies, @typescript-eslint/no-use-before-define */
/**
* @see https://github.com/bcoe/c8/issues/376
* @see https://github.com/tapjs/processinfo/blob/33c72e547139630cde35a4126bb4575ad7157065/lib/register-coverage.cjs
*/
if (process.env.V8_COVERAGE) {
process.setSourceMapsEnabled(true);
const inspector = require('inspector');
const session = new inspector.Session();
@rohit-gohri
rohit-gohri / docusaurus.config.js
Last active November 19, 2021 16:05 — forked from sibelius/docusaurus.config.js
docusuarus webpack 5 plugin to provide node polyfills
module.exports = {
plugins: [require.resolve('./sitePlugin')],
}
diff --git a/build/src/index.js b/build/src/index.js
index 7a3e8db5bc97f3786dc14bf8555721545534a952..00ef3fed50aeb28377b94ee43d1b068bbe82f57a 100644
--- a/build/src/index.js
+++ b/build/src/index.js
@@ -37,7 +37,7 @@ const plugin = (schema, documents, config) => {
exports.plugin = plugin;
const validate = (schema, documents, config, outputFile) => __awaiter(void 0, void 0, void 0, function* () {
if ((0, path_1.extname)(outputFile) !== ".tsx") {
- throw new Error(`Plugin "react-apollo" requires extension to be ".tsx"!`);
+ throw new Error(`Plugin "apollo-next-ssr" requires extension to be ".tsx"!`);
@rohit-gohri
rohit-gohri / md-cal.sh
Created August 16, 2020 20:11 — forked from jdbrice/md-cal.sh
Generate markdown table calendar. Use wiki links to individual days
# Author: Daniel Brandenburg
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@rohit-gohri
rohit-gohri / iTerm2-ssh.zsh
Last active July 23, 2020 14:09 — forked from erangaeb/iTrem2-ssh.zsh
colorize ssh
# tabc <profile name> do the profile change
function tabc() {
NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi
# if you have trouble with this, change
# "Default" to the name of your default theme
echo -e "\033]50;SetProfile=$NAME\a"
}
# reset the terminal profile to Default when exit from the ssh session
function tab-reset() {

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
@rohit-gohri
rohit-gohri / Redocusaurus.jsx
Last active June 20, 2023 21:51
Redocusaurus: Reodc for use with Docusaurus V2, MOVED TO https://github.com/rohit-gohri/redocusaurus
import React from 'react';
import merge from 'lodash.merge';
import { RedocStandalone } from 'redoc';
import useThemeContext from '@theme/hooks/useThemeContext';
import './styles.css';
/**
* NOTE: Colors taken from `node_modules/infima/styles/common/dark-mode.css`
* and related files
*/
@rohit-gohri
rohit-gohri / ansible-summary.md
Created April 20, 2020 10:31 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of