Skip to content

Instantly share code, notes, and snippets.

View AlfieDarko's full-sized avatar

Alfie Darko AlfieDarko

View GitHub Profile
/* Block component */
.checkout-form {
/* Elements */
&__title {
// ...
}
&__button {
// ...
}
&__input {
/* Block component */
.checkout-form {
// ..
}
/* Element that depends upon the block */
.checkout-form__title {
// ..
}
.checkout-form__input {
// ..
/* Super simplified html form to illustrate BEM classname usage. */
<form class="checkout-form checkout-form--darkmode">
<p class="checkout-form__title">
Buy Bitcoins!
</p>
<input class="checkout-form__input checkout-form__input--big"/>
import React, { Component } from 'react';
import './App.css';
import List from './ToDoList';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
term: '',
function returnFitPlayers(allPlayers, injuredPlayers) {
let result = allPlayers.filter((player) => {
!injuredPlayers.includes(player)
});
return result;
}
// filter through the manUTD team and return players
// that are NOT included in the injuredPlayers array
const fitPlayers = returnFitPlayers(manUTD, InjuredPlayers)
@AlfieDarko
AlfieDarko / reverse_mutation.js
Last active August 13, 2018 19:53
reverse_mutation.js
let first6Months = ["Jan", "Feb", "March", "April", "May", "June"]
console.log(first6Months)
// Expected output: [ "June", "May", "April", "March", "Feb", "Jan" ]
let first6MonthsClone
first6MonthsClone = first6Months.reverse()
console.log(first6Months)
// Expected output: ["Jan", "Feb", "March", "April", "May", "June"]
const manUTD = [
"David de Gea",
"Victor Lindelöf",
"Eric Bailly",
"Phil Jones",
"Marcos Rojo",
"Paul Pogba",
"Alexis Sánchez",
"Juan Mata",
"Romelu Lukaku",
console.log(fitPlayers)
// Expected output:
// [ 'David de Gea',
// 'Victor Lindelöf',
// 'Paul Pogba',
// 'Romelu Lukaku',
// 'Axel Tuanzebe',
// 'Scott McTominay',
// 'Diogo Dalot' ]
const manUTD = [
"David de Gea",
"Victor Lindelöf",
"Eric Bailly",
"Phil Jones",
"Marcos Rojo",
"Paul Pogba",
"Alexis Sánchez",
"Juan Mata",
"Romelu Lukaku",
const injuredPlayers = [
"Juan Mata",
"Joel Castro Pereira",
"Marcos Rojo",
"Phil Jones",
"Eric Bailly",
"Alexis Sánchez",
"Anthony Martial",
"Cameron Borthwick-Jackson"
]