This file contains hidden or 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
| fetch('someURL') | |
| .then((data) => data.json()) | |
| .then((data) => { | |
| const keysDuplicates = data.reduce((previous, current) => { | |
| if(!previous[current.key]) { | |
| previous[current.key] = 1; | |
| } else { | |
| previous[current.key] += 1; | |
| } |
This file contains hidden or 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
| // Extract the content in a Web Page and convert the data in a JSON object. | |
| function thisIsSparta($selector){ | |
| const items = Array.from(document.querySelectorAll($selector)); | |
| const agencies = items.map(item => { | |
| const url = item.querySelector('.field-name-field-web-page'); | |
| const address = item.querySelector('.field-name-field-address .field-item'); | |
| const agency = { | |
| name: item.querySelector('h3').textContent.trim(), | |
| phone: item.querySelector('.field-name-field-phone .field-item').textContent, |
This file contains hidden or 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
| { | |
| "transportes": [ | |
| { | |
| "name": "AS TRANSPORTES", | |
| "phone": "57 (4) 448 60 48 Ext", | |
| "address": "Cra 69 No 49 - 06", | |
| "location": "Medellín", | |
| "url": "www.astransportes.com.co" | |
| }, | |
| { |
This file contains hidden or 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
| #!/bin/bash | |
| files=$(git diff --cached --name-only | grep '\.jsx\?$') | |
| # Prevent ESLint help message if no files matched | |
| if [[ $files = "" ]] ; then | |
| exit 0 | |
| fi | |
| failed=0 | |
| for file in ${files}; do |
This file contains hidden or 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 invertColor(color){ | |
| const invertedColor = ('000000' + (0xFFFFFF ^ parseInt(color.substring(1), 16)).toString(16)).slice(-6); | |
| return `#${invertedColor}`; | |
| } |
This file contains hidden or 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
| let drink = 'Beers'; | |
| let snacks = 'Popcorn'; | |
| console.log(drink, snacks); | |
| [drink, snacks] = [snacks, drink]; | |
| console.log(drink, snacks); |
This file contains hidden or 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
| let drink = 'Beers'; | |
| let snacks = 'Popcorn'; | |
| console.log(drink, snacks); | |
| [drink, snacks] = [snacks, drink]; | |
| console.log(drink, snacks); |
This file contains hidden or 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 paddingLeft(str, length = 25) { | |
| return `${' '.repeat(length - str.length)}${str}`; | |
| } | |
| paddingLeft('This'); | |
| paddingLeft('is'); | |
| paddingLeft('Sparta!'); |
This file contains hidden or 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
| "use strict"; | |
| const gulp = require('gulp'); | |
| const connect = require('gulp-connect'); | |
| const open = require('gulp-open'); | |
| const lint = require('gulp-eslint'); | |
| const config = { | |
| port : 9005, | |
| devBaseUrl: 'http://localhost', |
This file contains hidden or 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
| #IntelliJ | |
| .idea | |
| .tmp | |
| dist | |
| # Logs | |
| logs | |
| *.log | |
| npm-debug.log* |