Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Thiago Bitencourt thiagobitencourt

🎯
Focusing
View GitHub Profile
@thiagobitencourt
thiagobitencourt / anagrams.js
Created Sep 16, 2020
Remove anagrams from text list
View anagrams.js
function anagrams(textList) {
const anagramList = [];
const foundAnagrams = [];
for (let i = 0; i < textList.length - 1; i++) {
const baseStr = textList[i];
if (!foundAnagrams.includes(baseStr)) {
const anagramsOnly = getAnagrams(baseStr, textList.slice(i + 1));
foundAnagrams.push(...anagramsOnly);
@thiagobitencourt
thiagobitencourt / get_attribute.sh
Last active Apr 27, 2019
Shell script function to get attribute from package.json file
View get_attribute.sh
get_attribute() { cat package.json | grep $1 | head -1 | cut -d ":" -f 2 | sed "s/[{, }, \", ',[:space:]]//g"; };
project=$(get_attribute "name\"");
echo $project