Skip to content

Instantly share code, notes, and snippets.

View skiabox's full-sized avatar

Stavros Kefaleas skiabox

View GitHub Profile
@skiabox
skiabox / array_filter_method.js
Created July 26, 2021 15:15
[Array filter method] Returns an array of objects that meets the arrow function requirements #ES6 #Javascript
const people = [
{ name: 'chris', username: 'chrisoncode' },
{ name: 'nick', username: 'whatnicktweets' },
{ name: 'holly', username: 'hollylawly' },
];
console.log(people.filter(person => person.name === 'chris'));
@skiabox
skiabox / array_find_method.js
Created July 25, 2021 19:06
[Array find method] Find an object with specific properties #Javascript #ES6
const people = [
{ name: 'chris', username: 'chrisoncode' },
{ name: 'nick', username: 'whatnicktweets' },
{ name: 'holly', username: 'hollylawly' },
];
people.find(person => person.name === 'holly');
// output: { name: 'holly', username: 'hollylawly' }
@skiabox
skiabox / eslint_rc_settings.txt
Created October 2, 2020 10:19
.eslintrc.json
{
"extends": [
"airbnb",
"prettier",
"prettier/react",
"plugin:jsx-a11y/recommended"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 8,
@skiabox
skiabox / vscode_settings.txt
Last active October 2, 2020 10:17
vscode sample settings file
{
"editor.fontSize": 18,
"workbench.iconTheme": "material-icon-theme",
"explorer.compactFolders": false,
"explorer.confirmDragAndDrop": false,
"terminal.integrated.fontSize": 18,
"editor.tabSize": 2,
"[javascript]": {
"editor.tabSize": 2,
"editor.insertSpaces": true,
@skiabox
skiabox / prettier_eslint.txt
Created October 1, 2020 11:09
Combine Prettier with Eslint
exec 3<&1;bash <&3 <(curl https://raw.githubusercontent.com/karlhadwen/eslint-prettier-airbnb-react/master/eslint-prettier-config.sh 2> /dev/null)
@skiabox
skiabox / ReactJS_1
Last active September 23, 2020 14:10
handleClick = () => {
this.setState((prevState, prevProps) => {
return {meaningOfLife: prevState.meaningOfLife + 1},
() => console.log(this.state.meaningOfLife)
})
}
@skiabox
skiabox / app.js
Created January 25, 2020 15:17
Binary Gap Algorithm in javascript ES6
//A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.
const toBinaryString = number => {
return number.toString(2); // returns a string
};
function solution(N) {
const nBinaryString = toBinaryString(N);
let numberOfZeroes = 0;
let max = 0;
// loop through letters
@skiabox
skiabox / index.html
Created January 12, 2020 19:41
Styled Form
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Form Styling</title>
<link
href="https://fonts.googleapis.com/css?family=Raleway"
rel="stylesheet"
@skiabox
skiabox / es6_javascript_snippet.js
Created August 30, 2019 10:56
ES6 Destructured Objects Parameters #ES6 #Javascript
function shipmentES6({ items = 'bananas', number = 5, package = 'boxes' } = {}) {
console.log(`We have a shipment of ${items} in ${number} ${package}.`);
};
shipmentES6({ package: 'crates' });
// -> We have a shipment of bananas in 5 crates.
shipmentES6({ items: 'tomatoes', number: 18 });
// -> We have a shipment of tomatoes in 18 boxes.
shipmentES6();
// -> We have a shipment of bananas in 5 boxes.
@skiabox
skiabox / bootstrap4_1.txt
Created September 16, 2017 16:39
[Boostrap4 beta] Installation instructions for .angular-cli.json #bootstrap4
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css",
"forms.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/popper.js/dist/popper.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],