This file contains 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
/* | |
* This is a JavaScript Scratchpad. | |
* | |
* Enter some JavaScript, then Right Click or choose from the Execute Menu: | |
* 1. Run to evaluate the selected text (Cmd-R), | |
* 2. Inspect to bring up an Object Inspector on the result (Cmd-I), or, | |
* 3. Display to insert the result in a comment after the selection. (Cmd-L) | |
*/ | |
(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==='object'&&typeof module==='object') |
This file contains 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
// Step 1: Clone repository from GitHub | |
$ git clone https://github.com/ericalli/static-site-boilerplate | |
&& cd static-site-boilerplate && rm -rf .git && git init | |
// Step 2: Install dependencies | |
$ npm install | |
// Step 3: Run the development server | |
$ npm run start | |
// Step 4: Generate production-ready files | |
$ npm run build:dist |
This file contains 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
# See https://github.com/RehanSaeed/EditorConfig for updates to this file. | |
# See http://EditorConfig.org for more information about .editorconfig files. | |
################# | |
# Common Settings | |
################# | |
# This file is the top-most EditorConfig file | |
root = true |
This file contains 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
{"lastUpload":"2020-10-06T04:44:07.041Z","extensionVersion":"v3.4.3"} |
This file contains 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
// bad | |
const foo = y && z; | |
// good | |
const isPostEnabled = isPost && postDateValid; | |
/*The art of naming variables by Richard Tan[https://hackernoon.com/the-art-of-naming-variables-52f44de00aad]*/ |
This file contains 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 request = require("request"); | |
var userDetails; | |
function getData(url) { | |
// Setting URL and headers for request | |
var options = { | |
url: url, | |
headers: { | |
'User-Agent': 'request' | |
} |
This file contains 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
4 2 1 | |
0 - - - no permissions | |
1 - - x only execute | |
2 - x - only write | |
3 - x x write and execute | |
4 x - - only read | |
5 x - x read and execute | |
6 x x - read and write | |
7 x x x read, write and execute |
This file contains 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
const {promisify} = require('util') | |
const sleep = promisify(setTimeout) | |
const request = async(data) => { | |
let time = Math.random() * 1000 | |
await sleep(time) | |
return {data, time} | |
} |
This file contains 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 mimeTypes = { | |
'.html': 'text/html', | |
'.js': 'text/javascript', | |
'.css': 'text/css', | |
'.json': 'application/json', | |
'.png': 'image/png', | |
'.jpg': 'image/jpg', | |
'.gif': 'image/gif', | |
'.svg': 'image/svg+xml', | |
'.wav': 'audio/wav', |
This file contains 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
// create a bookmark and use this code as the URL, you can now toggle the css on/off | |
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3 | |
javascript: (function() { | |
var elements = document.body.getElementsByTagName('*'); | |
var items = []; | |
for (var i = 0; i < elements.length; i++) { | |
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) { | |
items.push(elements[i]); | |
} | |
} |