Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View simov's full-sized avatar

simo simov

View GitHub Profile
@simov
simov / amo-notes-reviewer.md
Last active October 24, 2023 14:14
Notes to the reviewer

Markdown Viewer - Third-party Dependencies

Build the themes and vendor folders, and create the markdown-viewer.zip package:

# pick a release tag
git clone --depth 1 --branch firefox https://github.com/simov/markdown-viewer.git
# build
cd markdown-viewer/
@simov
simov / keybase.md
Created January 5, 2021 09:04
keybase.md

Keybase proof

I hereby claim:

  • I am simov on github.
  • I am simov (https://keybase.io/simov) on keybase.
  • I have a public key ASCAt2DzuPIz8LZpM4wu7FxNx8F1Q_iBW8SJqqesxDLuOQo

To claim this, I am signing this object:

@simov
simov / devto.js
Created September 8, 2019 12:53
Dev.to Dashboard
var compose = require('request-compose')
// DevTools -> Application -> Cookies
var token = '...'
var parse = (regex, string, map = (a) => a, result = [], match = regex.exec(string)) =>
!match ? result : parse(regex, string, map, result.concat(map(match)))
@simov
simov / prism-javascript.js
Created September 9, 2018 16:35 — forked from RexSkz/prism-javascript.js
JavaScript file highlight for Prism.js (support function arguments)
// current
Prism.languages.javascript = Prism.languages.extend('clike', {
'keyword': /\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,
'number': /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,
'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
});
@simov
simov / README.md
Last active March 28, 2024 03:26
Run `node` scripts using `nvm` and `crontab` without hardcoding the node version

Run node scripts using nvm and crontab without hardcoding the node version

cronjob.env.sh

#!/bin/bash

# NVM needs the ability to modify your current shell session's env vars,
# which is why it's a sourced function
@simov
simov / test-stable-sort.js
Last active February 7, 2018 20:27
Test Stable Sort
// https://github.com/mziccard/node-timsort/#stability
var t = require('assert')
// sorted by weight
var input = [
{ height: 100, weight: 80 },
{ height: 90, weight: 90 },
{ height: 70, weight: 95 },
@simov
simov / server.js
Created January 12, 2018 18:11
Serve static files with NodeJS and Express
var express = require('express')
var serveIndex = require('serve-index')
var serveStatic = require('serve-static')
var app = express()
app.use(serveStatic('/home/s'))
app.use('/', serveIndex('/home/s', {'icons': true, view: 'details'}))
app.listen(8001)
@simov
simov / check-for-git-changes.js
Last active December 31, 2017 17:10
Flat search for changed git repositories: `node check-for-git-changes.js path/to/projects/folder/`
var fs = require('fs')
var path = require('path')
var cp = require('child_process')
if (!process.argv[2]) {
console.log('Specify directory to check')
process.exit()
}
@simov
simov / slack-dark-theme.css
Last active October 4, 2017 12:17
Slack Dark Theme
/*set filter*/
html {
filter: invert(90%) hue-rotate(180deg);
background-color: rgb(25, 25, 25);
}
/*reset*/
img,
.emoji,
.emoji-outer,
@simov
simov / html-toc.js
Created January 22, 2017 10:57
Generate Table of Contents (TOC) from rendered HTML document's header tags
// extract all headers
var headers = []
function walk (nodes) {
nodes.forEach((node) => {
var sub = Array.from(node.childNodes)
if (sub.length) {
walk(sub)