Skip to content

Instantly share code, notes, and snippets.

View simov's full-sized avatar

simo simov

View GitHub Profile
@simov
simov / custome-theme.css
Created April 30, 2024 10:31
Markdown Viewer - Custom Theme
body {
font-family: 'Monospace', monospace;
}
table th { border-bottom: 2px solid; }
table td { border-right: 1px solid; padding: 5px 10px; }
table tr td:last-of-type { border: none; }
@media (prefers-color-scheme: dark) {
@simov
simov / amo-notes-reviewer.md
Last active April 30, 2024 09:42
Notes to the reviewer

Markdown Viewer - Build Instructions

Markdown Viewer is an open source browser extension hosted on GitHub: https://github.com/simov/markdown-viewer/tree/firefox

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

cd markdown-viewer/
sh build/package.sh firefox
@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 / 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)
@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 / 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 / authorize.html
Created December 5, 2015 15:40
Client Side Implicit OAuth Flow automation with NodeJS and NWjs
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Client Side Implicit OAuth Flow</title>
<script type="text/javascript" charset="utf-8">
var config = {
client_id: '[CLIENT_ID]',
redirect_uri: '[REDIRECT_URL]',
username: '[USERNAME]',
@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 / function-chain.js
Created April 27, 2013 16:19
Chaining asynchronous functions.
function chain () {
var funcs = arguments;
return function (args, cb) {
(function next (index) {
if (index == funcs.length) return cb();
funcs[index](args, function (err) {
if (err) return cb(err);
next(++index);
});