Skip to content

Instantly share code, notes, and snippets.

View hoflish's full-sized avatar
💭
I may be slow to respond.

Hassan Chabab hoflish

💭
I may be slow to respond.
View GitHub Profile
const arrayOfObjects = [{name: "Foo", ranking: 4.5}, {name: "Bar", ranking: 4}, {name: "Baz", ranking: 3.4}]
// getOrderedObjectsByRanking returns the objects ordered by ranking
const getOrderedObjectsByRanking = (array = arrayOfObjects) => array.sort((a,b) => (a.ranking > b.ranking) ? 1 : -1)
// getAverageRanking returns the average ranking
const getAverageRanking = (array = arrayOfObjects) => array.reduce((acc, curr) => acc + curr.ranking, 0) / arrayOfObjects.length
#Delete local tags.
git tag -d $(git tag -l)
#Fetch remote tags.
git fetch
#Delete remote tags.
git push origin --delete $(git tag -l) # Pushing once should be faster than multiple times
#Delete local tags.
git tag -d $(git tag -l)
@hoflish
hoflish / getInvalidURLs.js
Last active June 26, 2018 16:15
Invalid URLs Test Cases
/*
Extract TestLink Values from http://www.wvtesting.com/level2/InvlalidUrls-L2.html
Usage:
- Copy and paste this method into your browser js console, then run it:
> getInvalidURLs()
*/
function getInvalidURLs() {
const tBody = document.getElementsByClassName("uri-format")