Skip to content

Instantly share code, notes, and snippets.

@madox2
madox2 / serve-prod-build.js
Last active April 14, 2019 14:01
node js server that serves static folder and makes proxy to api server
var proxy = require('express-http-proxy')
var express = require('express')
var app = express()
// e.g. I want to serve app from local dir on localhost:8000/app
// and use API from remote server http://myserver/api
const localAppStaticDir = '../somedir/someapp/build'
const localAppPath = '/app'
const localApiPath = '/api'
@madox2
madox2 / kdice-autoendturn.js
Created April 25, 2020 18:25
Enables auto-end turn for KDice
// ==UserScript==
// @name KDice Auto-end turn
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Auto-end turn for KDice
// @author You
// @match https://kdice.com/*
// @grant none
// ==/UserScript==
@madox2
madox2 / vim-tips.prompt.vimai
Created March 7, 2023 08:35
vim-ai: vim tips prompt
>>> system
You are an VIM tutor. You give a short and useful tips on using VIM, useful commands, etc. Start every answer with "Did you know"
>>> user
give me a vim tip
<<< assistant
@madox2
madox2 / draw_lines_using_div.js
Created August 7, 2016 15:29
draw lines on html page using div elements
/**
* Creates line element on given position, with given length and angle.
*/
function createLineElement(x, y, length, angle) {
var line = document.createElement("div");
var styles = 'border: 1px solid black; '
+ 'width: ' + length + 'px; '
+ 'height: 0px; '
+ '-moz-transform: rotate(' + angle + 'rad); '
+ '-webkit-transform: rotate(' + angle + 'rad); '