Skip to content

Instantly share code, notes, and snippets.


Thanish mnmtanish

View GitHub Profile
npm install --arch=x64 --platform=linux --target=10.15.0 sharp
mnmtanish / vscode-settings.json
Created Jul 23, 2019
A minimal vscode, hides away most of the distracting stuff.
View vscode-settings.json
"diffEditor.ignoreTrimWhitespace": true,
"diffEditor.renderIndicators": false,
"editor.codeLens": false,
"editor.colorDecorators": false,
"editor.copyWithSyntaxHighlighting": false,
"editor.cursorStyle": "underline-thin",
"editor.dragAndDrop": false,
"editor.emptySelectionClipboard": false,
"editor.folding": false,
View gist:543dc11589f6b70ae2912403c68488db
window.getPathTo = (element) => {
if (element.tagName == 'HTML')
return '/HTML[1]';
if (element===document.body)
return '/HTML[1]/BODY[1]';
var ix= 0;
var siblings= element.parentNode.childNodes;
for (var i= 0; i<siblings.length; i++) {
var sibling= siblings[i];
mnmtanish / async-jasmine.ts
Last active Nov 26, 2018
Helper to handle observable and promise return values in jasmine unit tests
View async-jasmine.ts
import { once } from 'lodash';
export const that: typeof it = function ( ...args: any[]): void {
if ( args.length >= 2 ) {
const _assertion = args[1];
args[1] = function ( _done: any ) {
// FIXME: hides errors about done called multiple times
const done = once( _done );
const out = _assertion( done );
if ( out && typeof out.subscribe === 'function' ) {
View gist:9a4d36b7e86caa967cd605ebe283c227
* Excel Sheet Column Title
* Given a positive integer, return its column title as appear in an Excel sheet.
* Examples:
* 1 -> A
* 2 -> B
* 3 -> C

When you're debugging vague observable errors and you can't figure out where it's coming from.

  • Add a breakpoint on the line where it throws the error message
  • On the call stack, go up a little until you can find the observable instance
  • inspect it (usually it'll be the this variable)
  • check the _destination field and you may find the operator which is added after the faling operator (if there are any)
  • if you inspect the destination operator, you may find callback functions you gave to that operator => your app code! 🙂
View gist:8bb2800e78f70be8f387bb6deb3ce37b
"diffEditor.ignoreTrimWhitespace": true,
"diffEditor.renderIndicators": false,
"editor.codeLens": false,
"editor.colorDecorators": false,
"editor.cursorStyle": "underline-thin",
"editor.dragAndDrop": false,
"editor.emptySelectionClipboard": false,
"editor.folding": false,
"editor.fontFamily": "Fira Code",
View .zshrc
export GHPATH="$HOME/Github"
export GOPATH="$HOME/Gopath"
export CDPATH=".:$GHPATH:$GOPATH/src/"
export PATH="$HOME/.node/bin:$PATH"
export PATH="$GOPATH/bin:$PATH"
export PATH="$HOME/.bin:$PATH"
View svg-to-js.js
const fs = require('fs')
const { promisify } = require('util')
const svgson = require('svgson');
async function main() {
const [ input ] = process.argv.slice(2)
const svg = await readSVG(input)
await writeDef(input, svg2ctx(svg))
mnmtanish / fix-windows-npm-list.js
Created May 24, 2017
Fix npm list output on windows to match that of macos
View fix-windows-npm-list.js
const fs = require('fs')
const args = process.argv.slice(2)
let data = fs.readFileSync(args[0], 'utf-8')
data = data.replace(/- /g, '─ ')
data = data.replace(/\+-/g, '├─')
data = data.replace(/`-/g, '└─')
data = data.replace(/\|/g, '│')
const lines = data.split('\n')