Skip to content

Instantly share code, notes, and snippets.

View ticidesign's full-sized avatar

Ticiana de Andrade ticidesign

View GitHub Profile
function one (x) {
console.log(x);
}
function two (x, cb) {
setTimeout(function () {
console.log(x);
cb(x);
}, 1000);
}
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++) {
@ticidesign
ticidesign / stringy.js
Created February 25, 2017 09:20
A function that takes a size and returns a string of alternating '1s' and '0s'.
function stringy(size) {
// your code here
var word = "";
for(var i = 0; i < size; i++) {
word += i%2 === 1? "0" : "1";
}
return word;
}
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
*/
//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();
font-size: calc(20px + 6 * ((100vw - 320px) / 680));
@ticidesign
ticidesign / robots.txt
Created March 16, 2018 01:02
Robots.txt that makes sure Facebook and Twitter can crawl images on your site.
# 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
@ticidesign
ticidesign / fizzbuzz.js
Created May 24, 2018 23:41
FizzBuzz Concise
// 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 */
@ticidesign
ticidesign / react_context_api_example.js
Last active July 6, 2018 06:11
React’s New Context API
import React, { Component } from 'react';
const MyContext = React.createContext();
class MyProvider extends Component {
state = {
name: 'Tici',
age: 100,
cool: true
}
{
"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