Skip to content

Instantly share code, notes, and snippets.

/*
.__ .___ __ .__..__ .__..___..__..__ __.
| \[__ / `| |[__)[__] | | |[__)(__
|__/[___\__.|__|| \| | | |__|| \.__)
*/
/* ▀▀▀ once()
once(fn): creates a version of the function that executes only once.
It’s useful for an initialization function, where we want to make sure it
runs only once, no matter how many times it is called from different places.
______ _____ ____ ______ ______
| .~ ~. .-~ ~. | ~. .~ ~. .~ ~. | ..''
| | | : |____.'_ | | | | |..''
| | | : _____ | ~. | | | | |``..
|_______ `.______.' `-._____.'| |_______.' `.______.' `.______.' | ``..
PORT OF LOGTEN PRO
AEROTOUR Aviation LOGBOOK
This application is an attempt to port Aviation Logbook to web interface.
/*
.__..__ . ..__
[__][__)|\/|| \
| || \| ||__/
ARMD its Add, Read, Modify, Delete
*/
const users = [
{
id: 1,
@secretgspot
secretgspot / filterArray.js
Created September 28, 2019 06:59 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* 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 => {
// 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'
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
@secretgspot
secretgspot / likes.js
Last active September 26, 2019 05:42
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)]
}
@secretgspot
secretgspot / geosyl.js
Created December 31, 2018 04:09 — forked from aemkei/geosyl.js
Geosyl.js – Convert Latitude longitude Pairs to Readable Words
// 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(''),
@secretgspot
secretgspot / banner_template.txt
Created December 31, 2018 02:00
Banner Template
.-----------------------------------------------------------------.
/ .-. .-. \
| / \ / \ |
| |\_. | | /| |
|\| | /| |\ | |/|
| `---' | | `---' |
| | | |
| |-----------------------------------------------------| |
\ | | /
\ / \ /
@secretgspot
secretgspot / Three Wise Monkeys.md
Created December 31, 2018 01:17
Three Wise Monkeys (NDA)

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?