Skip to content

Instantly share code, notes, and snippets.

View mkoryak's full-sized avatar
🐈
Working

Misha Koryak mkoryak

🐈
Working
View GitHub Profile
@mkoryak
mkoryak / moplogger.js
Created July 7, 2021 14:20 — forked from bathos/moplogger.js
moplogger.js
// This is useful for a few things:
//
// 1. Checking what dictionary options are supported by some platform API.
// 2. Debugging mysterious cases where an object you pass as input to another
// API doesn’t seem to get treated the way you’re expecting.
// 3. When designing another Proxy’s handler implementation, verifying that you
// are accounting for everything correctly and that the intended abstraction
// isn’t leaking in quirky ways.
//
// ex:
@mkoryak
mkoryak / git-deletebranches.sh
Last active December 6, 2016 19:44 — forked from bxt/git-deletebranches.sh
Git Delete Merged Branches
#!/bin/bash
MAIN=${1:-develop}
BRANCHES=$(git branch --merged $MAIN | grep -v -e 'master\|staging\|develop\|\*')
echo Branches merged into $MAIN:
echo $BRANCHES
read -p "Delete these branches (y/n)? " answer
// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem
// throw QuotaExceededError. We're going to detect this and just silently drop any calls to setItem
// to avoid the entire page breaking, without having to do a check at each usage of Storage.
if (typeof localStorage === 'object') {
try {
localStorage.setItem('localStorage', 1);
localStorage.removeItem('localStorage');
} catch (e) {
Storage.prototype._setItem = Storage.prototype.setItem;
Storage.prototype.setItem = function() {};