let msg = [
{ payload: { errors: { unknown_language: 'hello' } } },
{ payload: { errors: { number: 1 } } },
{ randomstuff: 42 }
];
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
This file contains hidden or 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
backup-repos() { | |
for i in $(find . -type d -maxdepth 1 -mindepth 1); do | |
echo "Looking in $i..." | |
if [ -d "$i/.git" ]; then | |
echo "Found repository in $i, init backup..." | |
pushd $i > /dev/null | |
zip_name="$i-$(date +'%y%m%d').zip" | |
zip_path="/opt/backups/$zip_name" | |
echo "ZIP path: $zip_path" | |
if [ ! -f "$zip_path" ]; then |
This file contains hidden or 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 digit_to_string = { | |
0: 'zero', | |
1: 'one', | |
2: 'two', | |
3: 'three', | |
4: 'four', | |
5: 'five', | |
6: 'six', | |
7: 'seven', | |
8: 'eight', |
This file contains hidden or 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
<?php | |
function autoIncrement($start = 0, $step = 1, $circle = -1, $repeat = 1) { | |
$i = $start; | |
while (true) { | |
for ($j = 0; $j < $repeat; $j++) yield $i; | |
$i += $step; | |
if ($i === $circle) $i = $start; | |
} | |
} |