The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
// Geosyl.js – Convert Latitude longitude Pairs to Readable Words. | |
// based on David Troy's https://github.com/davetroy/hash-js | |
// also see: http://www.movable-type.co.uk/scripts/hash.html | |
// Distributed under the MIT License | |
geosyl = (function(){ | |
var bits = [32, 16, 8, 4, 2, 1], | |
vocals = 'aeiou'.split(''), | |
consonants = 'kgsztdnhfpmyr'.split(''), |
let names = ['billy', 'jill', 'peter', 'john', 'richard']; | |
function likes(names) { | |
return { | |
0: 'no one likes this', | |
1: `${names[0]} likes this`, | |
2: `${names[0]} and ${names[1]} like this`, | |
3: `${names[0]}, ${names[1]} and ${names[2]} like this`, | |
4: `${names[0]}, ${names[1]} and ${names.length - 2} others like this`, | |
}[Math.min(4, names.length)] | |
} |
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 3, 4, 5, 7, 7]; | |
// SHORTCUTS | |
const $ = (s) => document.querySelector(s); | |
const $$ = (s) => document.querySelectorAll(s); | |
const $$$ = (a) => Array.from(a); | |
$('#loader').classList.add('loading'); // single class selection | |
const responses = $$$(toggleResponsesButton.parentNode.querySelectorAll('.responses > .commentaire')); // create an array from node elements |
// Find screen resolution based on ratio | |
function findScreenHeight(width, ratio) { | |
const [widthRatio, heightRatio] = ratio.split(':') | |
const height = width / widthRatio * heightRatio | |
return width + 'x' + height | |
} | |
findScreenHeight(1280,"16:9"); // '1280x720' |
/** | |
* Filters an array of objects by custom predicates. | |
* | |
* @param {Array} array: the array to filter | |
* @param {Object} filters: an object with the filter criteria | |
* @return {Array} | |
*/ | |
function filterArray(array, filters) { | |
const filterKeys = Object.keys(filters); | |
return array.filter(item => { |
/* | |
.__..__ . ..__ | |
[__][__)|\/|| \ | |
| || \| ||__/ | |
ARMD its Add, Read, Modify, Delete | |
*/ | |
const users = [ | |
{ | |
id: 1, |
______ _____ ____ ______ ______ | |
| .~ ~. .-~ ~. | ~. .~ ~. .~ ~. | ..'' | |
| | | : |____.'_ | | | | |..'' | |
| | | : _____ | ~. | | | | |``.. | |
|_______ `.______.' `-._____.'| |_______.' `.______.' `.______.' | ``.. | |
PORT OF LOGTEN PRO | |
AEROTOUR Aviation LOGBOOK | |
This application is an attempt to port Aviation Logbook to web interface. |