Skip to content

Instantly share code, notes, and snippets.

@jwbenson
jwbenson / objectArrayToMarkdown.js
Created January 6, 2017 15:15
Object Array to Markdown Table
function objectArrayToMarkdown(arr) {
var keys = Object.keys(arr[0]);
arr.splice(0, 0, Object.assign({}, ...keys.map(key => ({ [key]: key }))));
arr.splice(1, 0, Object.assign({}, ...keys.map(key => ({ [key]: '---' }))));
return arr.map(row => {
return '| ' + (Array.isArray(row) ? row.join(' | ') : keys.map(key => row[key]).join(' | ')) + ' | ';
}).join('\n');
}
@jwbenson
jwbenson / perfectelementary.bash
Created July 14, 2017 00:35
Things to install on a fresh installation of ElementaryOS
#First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
#Install Google Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
#Install gedit (Text Editor)
@jwbenson
jwbenson / Gist.js
Last active October 14, 2018 18:21
gist key value store
class Gist {
constructor(options) {
this.token = options.token;
this.gistID = options.gistID;
this.fileName = options.filename || 'data.json';
this.description = options.description || 'unnamed stash';
this.cacheData = null;
}