Skip to content

Instantly share code, notes, and snippets.

View beaulac's full-sized avatar

antoine beauᵛᵃᴵˢ⁻lacᵃˢˢᵉ beaulac

View GitHub Profile
@beaulac
beaulac / send_clipboard.sh
Created February 16, 2018 17:11
(macOS) Send clipboard content to android keyboard, escaping every character.
#!/usr/bin/env bash
adb shell input text $(pbpaste | sed -e 's/\(.\)/\\\1/g')
@beaulac
beaulac / envify.js
Last active May 1, 2018 21:47
Hacky script to turn JSON into a .env file and spit out corresponding JS object to clipboard (mac only for now)
'use strict';
const path = require('path');
const fs = require('fs');
const argv = process.argv.slice(2);
let [filename, prefix = ''] = argv;
if (prefix) {
prefix = `${prefix}_`;
}
@beaulac
beaulac / node_mac_clip.js
Created February 8, 2018 16:25
Copy to clipboard w/ Node on Mac
const cp = require('child_process');
const clip = cp.exec('pbcopy', (_err, _stdout, _stderr) => {/* optionally do something */});
clip.stdin.write(aString);
clip.stdin.end(() => process.stdout.write(`\rCopied ${aString.length} characters.\n`));
@beaulac
beaulac / angular-storage.config.js
Created July 5, 2017 22:35
Proper checking of storage type
function StorageConfig(storeProvider) {
storeProvider.setStore(_determineStoreType());
function _determineStoreType() {
if ((typeof localStorage === 'object') && _checkStorage(localStorage)) {
return 'localStorage';
} else if ((typeof sessionStorage === 'object') && _checkStorage(sessionStorage)) {
return 'sessionStorage';
} else {
@beaulac
beaulac / gist:e960baaad1e7138397538d824045d2e5
Created May 19, 2017 01:15 — forked from sumardi/gist:5559896
Subdirectory checkouts with Git sparse-checkout
# New repository
mkdir <repo> && cd <repo>
git init
git remote add –f <name> <url>
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git pull <remote> <branch>
# Existing repository