Digital Ocean DevOps Cheatsheet (Ubuntu 16.04)
How to Deploy a Node.js App with SSL
Create an SSH key
We will need this for our server configuration
- Open console
// Using recursion this method will concatenate the values of nested arrays into a single array | |
function flatten(arr) { | |
var holder = []; | |
for(var i = 0; i < arr.length; i++) { | |
if(Array.isArray(arr[i])) { | |
holder = holder.concat(flatten(arr[i])); | |
} else { | |
holder.push(arr[i]); | |
} | |
} |
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
syntax on | |
set number | |
set tabstop=2 | |
set autoindent | |
set smarttab |
// Just run this file with node and give it a valid Javascript Date string or timestamp | |
// It will return the string with time ago it nomenclature given the timedifference | |
// | |
// @param {String} date [REQUIRED] | |
// @param {Boolean} short | |
// @param {string} current | |
// | |
// Author: Pedro Gomes | Github @gomesphoto | Twitter @gomesphoto | |
const nodeQuery = Number(process.argv[2]) |
// Copy & Paste to the browser's console and call function to adjust playbackRate for currenly playing videos | |
// Common playback rates are 0.25 / 0.5 / 0.75 / 1.0 / 1.25 / 1.5 / 1.75 / 2.0 | |
// Maximum value recommended is 4.0 (browser / hardward dependent) | |
// @param {Number} [rate = 1.0] | |
function changePlaybackRate(rate) { | |
var videos = document.getElementsByTagName('video'); | |
var currentlyPlaying = []; | |
var playbackRate = Number(rate) || 1.0; | |
for (var i = 0; i < videos.length; i++) { |
We will need this for our server configuration
// Install Homebrew | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
// Check if Homebrew Cask extension is installed | |
brew cask | |
(if not installed ===> brew install caskroom/cask/brew-cask) |
yarn add -D babel-eslint eslint eslint-config-react-app eslint-plugin-flowtype eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react
# OR
npm install --save-dev babel-eslint eslint eslint-config-react-app eslint-plugin-flowtype eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react
// Crawl nested object and find data that matches your __CONDITION__ | |
const crawlObject = (evalObj, prevObj, prevKey) => { | |
if (typeof evalObj === "object") { | |
Object.keys(evalObj).map((key) => crawlObject(evalObj[key], evalObj, key)); | |
} else { | |
if (__CONDITION__) { | |
// DO SOMETHING | |
console.log(prevObj[prevKey]) | |
} |
// @desc Creates a list of domains with custom TLDs using a pattern string with fixed length with option for keywords | |
// @param {String} pattern | |
// @param {Array|String} tlds | |
// @returns {Array} domainList | |
// | |
// | |
// Pattern string is defined by: | |
// - keywords lowercase | |
// - any letter uppercase A | |
// - consonants uppercase C |