Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

bojidaryovchev

🏠
Working from home
  • Bulgaria
View GitHub Profile
View partitionValues.js
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);
View moneyAmountToBulgarian.js
const masculineDigits = ['нула', 'един', 'два', 'три', 'четири', 'пет', 'шест', 'седем', 'осем', 'девет', 'десет'];
const feminineDigits = ['нула', 'една', 'две', 'три', 'четири', 'пет', 'шест', 'седем', 'осем', 'девет', 'десет'];
const teens = ['единайсет', 'дванайсет', 'тринайсет', 'четиринайсет', 'петнайсет', 'шестнайсет', 'седемнайсет', 'осемнайсет', 'деветнайсет']
const decimals = ['десет', 'двайсет', 'трийсет', 'четиридесет', 'петдесет', 'шейсет', 'седемдесет', 'осемдесет', 'деветдесет'];
const hundreds = ['сто', 'двеста', 'триста', 'четиристотин', 'петстотин', 'шестстотин', 'седемстотин', 'осемстотин', 'деветстотин'];
const thousands = ['хиляда', 'две хиляди', 'три хиляди', 'четири хиляди', 'пет хиляди', 'шест хиляди', 'седем хиляди', 'осем хиляди', 'девет хиляди'];
const moneySingular = 'лев';
const moneyPlural = 'лева';
const cent = 'стотинка';
View clock.html
<!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;
@bojidaryovchev
bojidaryovchev / tailwind-angular
Created Oct 29, 2020 — forked from kctang/tailwind-angular
Tailwind CSS support in Angular 10, with Angular Material
View tailwind-angular
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": {
@bojidaryovchev
bojidaryovchev / mongoosastic.txt
Last active Oct 11, 2020
Mongoose Mongoosastic ElasticSearch
View mongoosastic.txt
mongoosastic
mongoose.model('product', ProductSchema);
PUT http://localhost:9200/products
{
"settings": {
"analysis": {
"analyzer": {
@bojidaryovchev
bojidaryovchev / dateFormatter.js
Last active Sep 12, 2018
Date Formatting in JavaScript
View dateFormatter.js
const months = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
You can’t perform that action at this time.