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
// get an array of all the keys on the window | |
const dirty = Object.keys(window); | |
// Then create an iframe set to nothing | |
const iframe = document.createElement('iframe'); | |
iframe.src = ''; | |
// put it into the DOM | |
document.body.append(iframe); |
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
/* eslint-disable */ | |
String.prototype.sarcastic = function() { | |
return [...this] | |
.map((char, i) => char[`to${i % 2 ? 'Upper' : 'Lower'}Case`]()) | |
.join(''); | |
}; | |
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
# Uses tree - install first: | |
# brew install tree | |
function t() { | |
# Defaults to 3 levels deep, do more with `t 5` or `t 1` | |
# pass additional args after | |
tree -I '.git|node_modules|bower_components|.DS_Store' --dirsfirst --filelimit 15 -L ${1:-3} -aC $2 | |
} |
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 big array of 76 items I need to split into groups of 10 | |
const hugeArray = Array.from({ length: 76 }, (_, i) => i); | |
function chunkify(array, chunkSize = 10) { | |
// make a new array | |
const chunks = Array.from( | |
// give it however many slots are needed - in our case 8 | |
// 1-7 with 10 items, and 8th slot will have 6 | |
{ length: Math.ceil(array.length / chunkSize) }, | |
// this is a map function that will fill up our slots |
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
<h1>Cool text</h1> |
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
require('isomorphic-fetch'); | |
async function go(params) { | |
const variables = { | |
params: { | |
bqf: { callsite: 'COMMERCE_MKTPLACE_WWW', query: 'iphone' }, | |
browse_request_params: { | |
// burlington | |
filter_location_id: '108043585884666', | |
// hamilton |
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
{ | |
"window.zoomLevel": -1, | |
"editor.fontFamily": "Operator Mono, Menlo, Monaco, 'Courier New', monospace", | |
"editor.fontSize": 29, | |
"editor.lineHeight": 40, | |
"editor.letterSpacing": 0.5, | |
"workbench.editor.tabSizing": "shrink", | |
"eslint.autoFixOnSave": true, | |
"eslint.alwaysShowStatus": true, | |
"html.format.enable": 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> |
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 countryCodes = { | |
US: 'United States', | |
CA: 'Canada', | |
NG: 'Nigeria', | |
GB: 'United Kingdom', | |
}; | |
const sales = [ | |
{ code: 'US', count: 233 }, |
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
// 🔥 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 | |
}); | |
} |