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
function one (x) { | |
console.log(x); | |
} | |
function two (x, cb) { | |
setTimeout(function () { | |
console.log(x); | |
cb(x); | |
}, 1000); | |
} |
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
for(let i=1; i <= 100; i++){ | |
if (i%15 === 0){console.log('FizzBuzz');} | |
else if(i%3 === 0){ console.log('Fizz');} | |
else if (i%5 === 0){console.log('Buzz');} | |
else { console.log(i);} | |
} | |
for (var i = 1; i <= 100; i++) { |
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
function stringy(size) { | |
// your code here | |
var word = ""; | |
for(var i = 0; i < size; i++) { | |
word += i%2 === 1? "0" : "1"; | |
} | |
return word; | |
} |
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
html { | |
/* border-box box model allows us to add padding and border to our elements without increasing their size */ | |
box-sizing: border-box; | |
} | |
/* | |
WHAT IS THIS?! | |
We inherit box-sizing: border-box; from our <html> selector | |
Apparently this is a bit better than applying box-sizing: border-box; directly to the * selector | |
*/ |
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
//Fight LinkdIn Recruiter Spam with JavaScript! | |
[...document.querySelectorAll('.mn-invitation-card')].forEach(card => { | |
const headline = card.querySelector('.mn-person-info__occupation').textContent; | |
const accept = card.querySelector('button[data-control-name="accept"]'); | |
const decline = card.querySelector('button[data-control-name="decline"]'); | |
const name = card.querySelector('.mn-person-info__name').textContent; | |
if(headline.match(/recruit/gi)) { | |
console.log(`Nah. ${name} looks a little fishy to me. 🐡`); | |
decline.click(); |
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
font-size: calc(20px + 6 * ((100vw - 320px) / 680)); |
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
# Disallow everything. | |
User-agent: * | |
Disallow: / | |
# Certain social media sites are whitelisted to allow crawlers to access page markup when links to /images are shared. | |
User-agent: Twitterbot | |
Allow: /images | |
User-agent: facebookexternalhit | |
Allow: /images |
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
// Concise | |
var f='Fizz', b='Buzz', i=0, d3, d5; | |
for (i; ++i <= 100; d3 = !(i % 3), d5 = !(i % 5), console.log(d3 ? d5 ? f+b : f : d5 ? b : i)); | |
// Multi-line, commented | |
var /* Declare our variables outside the loop, a performance best-practice */ | |
f='Fizz', /* Variable `f` so we don't repeat 'Fizz' twice - DRY */ | |
b='Buzz', /* Variable `b` so we don't repeat 'Buzz' twice - DRY */ | |
i=0, /* For-loop counter, start at 0 */ | |
d3, /* setup a variable for checking divisibility by 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
import React, { Component } from 'react'; | |
const MyContext = React.createContext(); | |
class MyProvider extends Component { | |
state = { | |
name: 'Tici', | |
age: 100, | |
cool: 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
{ | |
"editor.fontSize": 12, | |
"editor.tabSize": 2, | |
"editor.parameterHints": false, | |
"editor.minimap.enabled": false, | |
"editor.insertSpaces": false, | |
"editor.snippetSuggestions": "top", | |
"editor.formatOnSave": false, | |
"[javascript]": { | |
"editor.formatOnSave": false |
OlderNewer