Skip to content

Instantly share code, notes, and snippets.

View contolini's full-sized avatar
🐛
call me

Chris Contolini contolini

🐛
call me
View GitHub Profile
@contolini
contolini / getCache.js
Last active January 17, 2020 14:58 — forked from ryanflorence/getCache.js
Memoization of jQuery's $.getJSON() to use localStorage for caching.
var getCache = function(url) {
var supportsLocalStorage = 'localStorage' in window;
// Both functions return a promise, so no matter which function
// gets called inside getCache, you get the same API.
function getJSON(url) {
var promise = $.getJSON(url);
config_files = Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf")
config_files.each do |file|
certificate_files = ['ca', 'cert', 'key', 'tls-auth']
config_dir = File.dirname(file)
connection_name = nil
new_config = []
File.read(file).each_line do |line|
line.strip!
@contolini
contolini / npm-tmp-clean.sh
Last active March 1, 2017 19:36 — forked from nemisj/npm-tmp-clean.sh
Removing npm tmp after install
#!/usr/bin/env bash
# this is pid of the bash we are in
bash_pid=$$
bash_pid=$(echo -e ${bash_pid} | tr -d '[[:space:]]');
# this is shell of the bash
shell_pid=$(ps -p ${bash_pid} -o ppid=;)
shell_pid=$(echo -e ${shell_pid} | tr -d '[[:space:]]');