This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Atom editor: https://atom.io/ | |
- download and install | |
- install sync setting package | |
PAT: 2083defe32ac2d396638329c8a9d59f26b594031 | |
GIST ID: dc58bfdf1cc2fa2e502e21c0958bddb5 | |
2) NVM (Node.js Version Manager) | |
- $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash | |
3) Homebrew |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works | |
const axios = require('axios'); // promised based requests - like fetch() | |
function getCoffee() { | |
return new Promise(resolve => { | |
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Merge Sort | |
*/ | |
const mergeSort = (nums) => { | |
if (nums.length < 2) return nums; | |
const length = nums.length; | |
const middle = Math.floor(length / 2); | |
const left = nums.slice(0, middle); | |
const right = nums.slice(middle, length); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Make a function that computes a factorial recursively. | |
A factorial is when you take a number n and multiply by each preceding integer until you hit one. | |
n * (n-1) * (n-2) ... * 3 * 2 * 1 | |
Call the function factorial | |
factorial(1) = 1 | |
factorial(2) = 2 | |
factorial(3) = 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Insertion sort | |
The idea here is that the beginning of your list is sorted and the everything else is assumed to be an unsorted mess. | |
The outer loop goes over the whole list, the index of which signifies where the "sorted" part of the list is. The inner | |
loop goes over the sorted part of the list and inserts it into the correct position in the array. | |
*/ | |
var insertionSort = (nums) => { | |
for (let i = 1; i < nums.length; i++) { | |
for (let j = 0; j < i; j++) { | |
snapshot(nums); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Bubble sort works by comparing two adjacent numbers next to each other and then | |
swapping their places if the smaller index's value is larger than the larger | |
index's. Continue looping through until all values are in ascending order | |
*/ | |
const bubbleSort = (arr) => { | |
arr.forEach((n, i) => { | |
if (arr[i] > arr[i + 1]) { | |
arr[i] = arr[i + 1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isMobile = { | |
Android: function() { return navigator.userAgent.match(/Android/i); }, | |
BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, | |
iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, | |
Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, | |
Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, | |
any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; | |
// var isTouch = ("ontouchstart" in document.documentElement); | |
// Chrome Version 37.0.2062.103 m (this version of chrome is firing touchstart event even tho it is not a mobile browser) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/3069522 | |
;(function($, window, document, undefined) { | |
// Prepare our Variables | |
var History = window.History; | |
// Check to see if History.js is enabled for our Browser | |
if (!History.enabled) { | |
return false; | |
} |