Skip to content

Instantly share code, notes, and snippets.

@rlueder
rlueder / rename.js
Last active May 17, 2024 01:56 — forked from microbial/rename.js
lodash helpers - rename (renames object keys)
/*
* var person = { firstName: 'bill', lastName: 'johnson' }
*
* person = _.rename(person, 'firstName', 'first')
* person = _.rename(person, 'lastName', 'last')
*
* console.log(person) // { first: 'bill', last: 'johnson' }
*/
_.rename = (obj, key, newKey) => {
@ryanve
ryanve / log-tab-focus.js
Last active May 17, 2024 01:56
Log :focus element each time tab key is pressed
document.addEventListener('keyup', function(e) {
9 != e.keyCode || e.metaKey || e.ctrlKey || console.log(document.activeElement)
}, false)
@rlueder
rlueder / log-tab-focus.js
Created August 28, 2017 19:44 — forked from ryanve/log-tab-focus.js
Log :focus element each time tab key is pressed
document.addEventListener('keyup', function(e) {
9 != e.keyCode || e.metaKey || e.ctrlKey || console.log(document.activeElement)
}, false)
/**
* @name debounce
* @summary Debounces "func" within "wait".
* @see {@link https://davidwalsh.name/javascript-debounce-function}
* @see {@link https://www.freecodecamp.org/news/javascript-debounce-example/}
* @example <button onClick={debounce(() => console.log("1s"), 1000)}>Debounce</button>
* @param {Function} func
* @param {number} [wait]
* @returns {Function}
*/
@rlueder
rlueder / encode-decode-base64
Created December 8, 2017 17:45
encode/decode strings to/from base64 on the terminal
// Encode
echo -n 'username:password' | openssl base64
// dXNlcm5hbWU6cGFzc3dvcmQ=
// Decode
echo `echo dXNlcm5hbWU6cGFzc3dvcmQ= | base64 --decode`
// username:password
@felschr
felschr / tailscale-lock-sign-mullvad-exit-nodes.nu
Last active May 17, 2024 01:54
Tailnet Lock: Sign Mullvad exit nodes
#! /usr/bin/env nu
let $status = tailscale lock status --json | from json
let $nodes = $status | get FilteredPeers
let $nodes_mullvad = $nodes | where Name =~ ".mullvad.ts.net"
let count_total = $nodes | length
let count_mullvad = $nodes_mullvad | length
@microbial
microbial / rename.js
Last active May 17, 2024 01:54
lodash helpers - rename (renames object keys)
/*
* var person = { firstName: 'bill', lastName: 'johnson' }
*
* person = _.rename(person, 'firstName', 'first')
* person = _.rename(person, 'lastName', 'last')
*
* console.log(person) // { first: 'bill', last: 'johnson' }
*/
_.rename = function(obj, key, newKey) {
/*!
* ExternalTemplateRemotesPlugin
* License: MIT (https://mit-license.org/)
*/
const extractUrlAndGlobal = require('webpack/lib/util/extractUrlAndGlobal');
const { RawSource } = require('webpack-sources');
const PLUGIN_NAME = 'ExternalTemplateRemotesPlugin';
/*!
* ExternalTemplateRemotesPlugin
* License: MIT (https://mit-license.org/)
*/
const extractUrlAndGlobal = require('webpack/lib/util/extractUrlAndGlobal');
const { RawSource } = require('webpack-sources');
const PLUGIN_NAME = 'ExternalTemplateRemotesPlugin';