Skip to content

Instantly share code, notes, and snippets.

View thiagobitencourt's full-sized avatar
🎯
Focusing

Thiago Bitencourt thiagobitencourt

🎯
Focusing
View GitHub Profile
@thiagobitencourt
thiagobitencourt / anagrams.js
Created September 16, 2020 11:36
Remove anagrams from text list
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 April 27, 2019 13:22
Shell script function to get attribute from package.json file
get_attribute() { cat package.json | grep $1 | head -1 | cut -d ":" -f 2 | sed "s/[{, }, \", ',[:space:]]//g"; };
project=$(get_attribute "name\"");
echo $project