Skip to content

Instantly share code, notes, and snippets.

Adrian Juszczak Juszczak

Block or report user

Report or block Juszczak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Juszczak
Juszczak / localstorage-safari-private-shim.js
Last active Aug 29, 2015
Don't let localStorage/sessionStorage setItem throw errors in Safari Private Browsing Mode
View localstorage-safari-private-shim.js
// 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.
(function(){
if (typeof localStorage === 'object') {
try {
localStorage.setItem('localStorage', 1);
localStorage.removeItem('localStorage');
} catch (e) {
Storage.prototype._setItem = Storage.prototype.setItem;
@Juszczak
Juszczak / couchdb-cors.sh
Created Jul 6, 2015
Add some generic CORS configuration to your CouchDB using curl. You can always change the configuration by simply going to http://127.0.0.1:5984/_utils/config.html and updating the values. However, these default options are good for getting up and running.
View couchdb-cors.sh
HOST=http://name:password@127.0.0.1:5984 # or whatever you got
curl -X PUT $HOST/_config/httpd/enable_cors -d '"true"'
curl -X PUT $HOST/_config/cors/origins -d '"*"'
curl -X PUT $HOST/_config/cors/credentials -d '"true"'
curl -X PUT $HOST/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"'
curl -X PUT $HOST/_config/cors/headers -d '"accept, authorization, content-type, origin, referer, x-csrf-token"'
@Juszczak
Juszczak / disable-shadow.sh
Created Oct 26, 2015
Disable the Window Shadow on Screen Shots in Mac OS X
View disable-shadow.sh
defaults write com.apple.screencapture disable-shadow -bool true
killall SystemUIServer
@Juszczak
Juszczak / s3copy-across-aws-accounts.js
Created Nov 18, 2015 — forked from raffi-minassian/s3copy-across-aws-accounts.js
Quick and dirty script to copy files in AWS S3 to an S3 bucket in another AWS account with Node.js.
View s3copy-across-aws-accounts.js
/*
* This is a quick and dirty script for copying files in AWS S3 to other buckets.
* This is written so it can work across AWS accounts.
* You can hack in code to apply work or logic to each file.
*
* For each file, it downloads locally to a tmp file and then starts uploading as soon as possible
* and deletes the file immediately when the upload is done.
*
* Best way to use: Spin up a micro in EC2, install node.js,
* create a directory and install the dependencies with
View keybase.md

Keybase proof

I hereby claim:

  • I am juszczak on github.
  • I am juszczak (https://keybase.io/juszczak) on keybase.
  • I have a public key ASDhgxSrsMgfIAUaa-q2s4hD_gtMUWmdOyo3lNlv9-a2zQo

To claim this, I am signing this object:

View gpg.asc
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2
mQINBFicbNQBEADiIkNXvo26KhTKVfwiby+THPQRvaFYT6WN+zqc3/bAe8bYXGDV
AxRvdE1+2rjgtiUHFUEZ41CuMrS2W142kDVnY9RjbxBVw1Q2W+h+y+5UT21Xqtoi
RTV64mXYkRUpnmV7dWco6g+gO+imPNHR0bBlBDWrMtq5PNq40h5sRQmF/v9x8Pe3
8aWyFfmtRsV1lqRavkt/GwLoxyCDxdEKemApwjHanKw/Yu9g71tE8icwnYy1u8cn
86nw9y04K1AY93pgxu3XR80nWICs4D0rfPDH2SG9b86TIgENNXZBvrLTzRaRwN5l
aCmRR5NcLJcoZH7ydeZMOhX45irnnmEzmYlSKO7oLB0MFgXjFw8bQ9lmQ/gNnZr3
rH9BnTX4Sx2EGyL9tzO3+4DXuEmzaW8hN4+dNupoDSO5gfL3JmnPVYEhAeN5HBLR
@Juszczak
Juszczak / converter.js
Last active Jun 1, 2017
dirty `.json` <-> `.properties` converter
View converter.js
const fs = require('fs')
const path = require('path')
const PROPS_DELIMITER = '='
const readJSON = fileName => JSON.parse(fs.readFileSync(path.resolve(process.cwd(), fileName), 'utf8'))
const toJSON = data => {
const output = {}
data.split('\n')
@Juszczak
Juszczak / KeyCodes.ts
Created Jul 21, 2017
KeyboardEvent key codes enum
View KeyCodes.ts
export enum KeyCodes {
Backspace = 8,
Tab = 9,
Enter = 13,
Shift = 16,
Ctrl = 17,
Alt = 18,
PauseBreak = 19,
CapsLock = 20,
Escape = 27,
@Juszczak
Juszczak / get_buffers_number.vim
Created Sep 7, 2017
Returns number of buffers in Vim
View get_buffers_number.vim
function! GetBuffersNumber()
return len(filter(range(1, bufnr('$')), 'buflisted(v:val)'))
endfunction
@Juszczak
Juszczak / watcher.sh
Created Jan 13, 2018
Fix FS Watcher on Ubuntu
View watcher.sh
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf ; sudo sysctl -p
You can’t perform that action at this time.