let msg = [
{ payload: { errors: { unknown_language: 'hello' } } },
{ payload: { errors: { number: 1 } } },
{ randomstuff: 42 }
];
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const permutations = function*(elements, map = new Map()) { | |
if (elements.length === 1) { | |
yield elements; | |
} else { | |
const [first, ...rest] = elements; | |
for (const perm of permutations(rest, map)) { | |
for (let i = 0; i < elements.length; i++) { | |
const start = perm.slice(0, i); | |
const rest = perm.slice(i); | |
const val = [...start, first, ...rest]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sync-code-projects() { | |
CODE_PROJECTS_FILE="$HOME/Library/Application Support/Code/User/projects.json" && \ | |
echo "[" > "$CODE_PROJECTS_FILE" && \ | |
find ~/Projects \ | |
-maxdepth 1 \ | |
-type d \ | |
-execdir echo "{ \"name\": \"{}\", \"rootPath\": \"$HOME/Projects/{}\", \"enabled\": true }," >> "$CODE_PROJECTS_FILE" \; && | |
echo "{}]" >> "$CODE_PROJECTS_FILE" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Download all the photos of a Facebook Album / "Photos of you" | |
If you want to download "the photos that you uploaded", | |
use the simpler "Your Facebook Information" feature on https://www.facebook.com/settings?tab=your_facebook_information | |
This script is only useful to download the photos you've been tagged into | |
You can find this page on: https://www.facebook.com/photos | |
Make sure you scroll 'til the end of the page, and then paste it into the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkgj-run-list() { | |
jq .scripts package.json | grep -o '.*\":' | sed -nE 's/\"(.*)\":/\1/p' | awk '{$1=$1};1' | fzf | tr -d '\r' | tr -d '\n' | |
} | |
yarn-x() { | |
PKG_CMD=$(pkgj-run-list) | |
[ -n "$PKG_CMD" ] && print -s "yarn $PKG_CMD" && yarn "$PKG_CMD" | |
} | |
alias yx="yarn-x" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
formatBody = (body) => { if (!body) return body; try { return JSON.parse(body); } catch (err) { return body; } }; | |
XMLHttpRequest.prototype._open = XMLHttpRequest.prototype._open || XMLHttpRequest.prototype.open; | |
XMLHttpRequest.prototype.open = function() { | |
this._openArgs = arguments; | |
return XMLHttpRequest.prototype._open.apply(this, arguments); | |
}; | |
XMLHttpRequest.prototype._send = XMLHttpRequest.prototype._send || XMLHttpRequest.prototype.send; | |
XMLHttpRequest.prototype.send = function(body) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get -y install unattended-upgrades | |
dpkg-reconfigure --priority=low unattended-upgrades |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set myChannels to {"random"} # Populate this field | |
set theResponse to display dialog "What's your message?" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue" | |
set theMessage to text returned of theResponse | |
tell application "Slack" | |
activate | |
tell application "System Events" | |
repeat with theChannel in myChannels |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
dscl . readpl "/Users/$(whoami)" dsAttrTypeNative:LinkedIdentity "appleid.apple.com:linked identities:0:full name" | awk '{print $4}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Class AutoUpdater | |
Public newVersion As String | |
Public urlOfCab As String | |
Public credentials As Net.NetworkCredential | |
Public askDest As Boolean = False | |
Public deleteCab As Boolean = True | |
Public useUI As Boolean = False | |
Public permitUninstall As Boolean = False |