This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const months = [ | |
'January', | |
'February', | |
'March', | |
'April', | |
'May', | |
'June', | |
'July', | |
'August', | |
'September', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongoosastic | |
mongoose.model('product', ProductSchema); | |
PUT http://localhost:9200/products | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: client/angular.json | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- client/angular.json (revision fcfaf7440d0eaed6baa841b2b4d9eca231b002f6) | |
+++ client/angular.json (date 1603593891228) | |
@@ -39,7 +39,7 @@ | |
"prefix": "app", | |
"architect": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
<style> | |
.clock { | |
background: #414141; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function partitionValues(total, minValue, values) { | |
const percentageByValue = {}; | |
values.filter(v => v > minValue).forEach(v => percentageByValue[v] = v / total * 100); | |
total -= values.filter(v => v <= minValue).reduce((p, c) => p + c, 0); | |
const totalPercentage = Object.keys(percentageByValue) | |
.map(k => percentageByValue[k]) | |
.reduce((prev, curr) => prev + curr, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in index.html | |
// <script src="https://cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.min.js" integrity="sha512-01CJ9/g7e8cUmY0DFTMcUw/ikS799FHiOkA0eyHsUWfOetgbx/t6oV4otQ5zXKQyIrQjGTHSmRVPIgrgLccZi/WMA==" crossorigin="anonymous"></script> | |
// <script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js" integrity="sha512-Qlv6VSKh1lgDKGoJbnyA5RMXYcvnpIqhO++MhkIM2fStMcGT9i2T//tSwYFlcyoRRDcDZ+TYHpH8azBBCyqhpSeqw==" crossorigin="anonymous"></script> | |
// in typescript | |
import 'dom-to-image'; | |
import 'file-saver'; | |
import * as mergeBase64 from 'merge-base64'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const masculineDigits = ['нула', 'един', 'два', 'три', 'четири', 'пет', 'шест', 'седем', 'осем', 'девет', 'десет']; | |
const feminineDigits = ['нула', 'една', 'две', 'три', 'четири', 'пет', 'шест', 'седем', 'осем', 'девет', 'десет']; | |
const teens = ['единайсет', 'дванайсет', 'тринайсет', 'четиринайсет', 'петнайсет', 'шестнайсет', 'седемнайсет', 'осемнайсет', 'деветнайсет'] | |
const decimals = ['десет', 'двайсет', 'трийсет', 'четиридесет', 'петдесет', 'шейсет', 'седемдесет', 'осемдесет', 'деветдесет']; | |
const hundreds = ['сто', 'двеста', 'триста', 'четиристотин', 'петстотин', 'шестстотин', 'седемстотин', 'осемстотин', 'деветстотин']; | |
const thousands = ['хиляда', 'две хиляди', 'три хиляди', 'четири хиляди', 'пет хиляди', 'шест хиляди', 'седем хиляди', 'осем хиляди', 'девет хиляди']; | |
const moneySingular = 'лев'; | |
const moneyPlural = 'лева'; | |
const cent = 'стотинка'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- viewport height fix --> | |
<script> | |
function recalculateViewportHeight() { | |
// First we get the viewport height and we multiple it by 1% to get a value for a vh unit | |
const vh = window.innerHeight * 0.01; | |
// Then we set the value in the --vh custom property to the root of the document | |
document.documentElement.style.setProperty('--vh', `${vh}px`); | |
} | |
window.addEventListener('load', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getDates(date: Date): Date[] { | |
const dates: Date[] = []; | |
const firstDate: Date = new Date(new Date(date).setDate(1)); | |
const firstDateDay: number = firstDate.getDay(); | |
const daysBeforeFirst: number = firstDateDay - 1 === -1 ? 6 : firstDateDay - 1; | |
for (let i = daysBeforeFirst - 1; i >= 0; i--) { | |
dates.push(new Date(new Date(date).setDate(-i))); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here is an idea of a coding convention inspired by pure functions: | |
// Let's look at the following example: | |
interface Stuff {} | |
interface OtherStuff {} | |
class StuffApi { | |
getStuff(): Promise<Stuff> { |
OlderNewer