Skip to content

Instantly share code, notes, and snippets.

View TeonWasTaken's full-sized avatar

Teon TeonWasTaken

  • Canberra, Australia
View GitHub Profile
@dunnza
dunnza / setupProxy.js
Last active November 7, 2022 07:54
How to proxy api requests with NTLM authentication in a create-react-app project
const http = require("http");
const proxy = require("http-proxy-middleware");
module.exports = function(app) {
app.use(
"/api",
proxy({
agent: new http.Agent({ keepAlive: true }),
target: "http://example.com/",
onProxyRes(proxyRes) {
@tigt
tigt / git-branch-to-favicon.js
Created March 18, 2020 21:10
Creates an SVG string that can be used as a favicon across different Git branches. Actually getting this into the browser is sadly project-specific.
const { execSync } = require('child_process')
const { createHash } = require('crypto')
const invertColor = require('invert-color')
const branchName = execSync('git rev-parse --abbrev-ref HEAD')
const hash = createHash('sha256')
hash.update(branchName)
const color = '#' + hash.digest().toString('hex').substring(0, 6)
const invertedColor = invertColor(color, true)