Skip to content

Instantly share code, notes, and snippets.

View polRk's full-sized avatar
💯

Vladislav Polyakov polRk

💯
View GitHub Profile
@polRk
polRk / findBestPlacement.js
Last active October 28, 2018 09:42
Find the best placement of buttons in columns. Viber richMessage (see example.ts)
const findBestPlacement = (count) => {
const result = [4, 5, 6, 7].map(rows => ({
'Rows': rows,
'Columns': ((count / rows) ^ 0) === (count / rows) ? count / rows : (count / rows >> 0) + 1,
'Excess': count % rows,
'Free': count % rows === 0 ? 0 : rows - count % rows
}));
return [...result]
.filter((item) => {
@polRk
polRk / actions.ts
Last active June 23, 2019 06:00
Uon webhook actions
/**
* Change manager in lead
{
datetime: '2019-06-23 08:38:19',
type_id: '29',
user_id: '2',
r_id: '1310',
old_manager_id: '2',
new_manager_id: '14'
@polRk
polRk / generate.js
Created July 8, 2019 07:28 — forked from dehamzah/generate.js
Generate secret key in NodeJS
require('crypto').randomBytes(32, function(err, buffer) { var token = buffer.toString('hex'); console.log(token); });
{"lhrSlim":[{"id":"performance","title":"Performance","score":0.18},{"id":"accessibility","title":"Accessibility","description":"These checks highlight opportunities to [improve the accessibility of your web app](https://developers.google.com/web/fundamentals/accessibility). Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged.","score":0.6,"manualDescription":"These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://developers.google.com/web/fundamentals/accessibility/how-to-review)."},{"id":"best-practices","title":"Best Practices","score":0.62},{"id":"seo","title":"SEO","description":"These checks ensure that your page is optimized for search engine results ranking. There are additional factors Lighthouse does not check that may affect your search ranking. [Learn more](https://support.google.com/webmasters/answer/35769).","score":0.98,"manualDescription":"Run these addi
{"lhrSlim":[{"id":"performance","title":"Performance","score":0.2},{"id":"accessibility","title":"Accessibility","description":"These checks highlight opportunities to [improve the accessibility of your web app](https://developers.google.com/web/fundamentals/accessibility). Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged.","score":0.6,"manualDescription":"These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://developers.google.com/web/fundamentals/accessibility/how-to-review)."},{"id":"best-practices","title":"Best Practices","score":0.62},{"id":"seo","title":"SEO","description":"These checks ensure that your page is optimized for search engine results ranking. There are additional factors Lighthouse does not check that may affect your search ranking. [Learn more](https://support.google.com/webmasters/answer/35769).","score":0.98,"manualDescription":"Run these addit
{"lhrSlim":[{"id":"performance","title":"Performance","score":0.17},{"id":"accessibility","title":"Accessibility","description":"These checks highlight opportunities to [improve the accessibility of your web app](https://developers.google.com/web/fundamentals/accessibility). Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged.","score":0.6,"manualDescription":"These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://developers.google.com/web/fundamentals/accessibility/how-to-review)."},{"id":"best-practices","title":"Best Practices","score":0.62},{"id":"seo","title":"SEO","description":"These checks ensure that your page is optimized for search engine results ranking. There are additional factors Lighthouse does not check that may affect your search ranking. [Learn more](https://support.google.com/webmasters/answer/35769).","score":0.98,"manualDescription":"Run these addi
{"lhrSlim":[{"id":"performance","title":"Performance","score":0.18},{"id":"accessibility","title":"Accessibility","description":"These checks highlight opportunities to [improve the accessibility of your web app](https://developers.google.com/web/fundamentals/accessibility). Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged.","score":0.6,"manualDescription":"These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://developers.google.com/web/fundamentals/accessibility/how-to-review)."},{"id":"best-practices","title":"Best Practices","score":0.62},{"id":"seo","title":"SEO","description":"These checks ensure that your page is optimized for search engine results ranking. There are additional factors Lighthouse does not check that may affect your search ranking. [Learn more](https://support.google.com/webmasters/answer/35769).","score":0.98,"manualDescription":"Run these addi
{"lhrSlim":[{"id":"performance","title":"Performance","score":0.18},{"id":"accessibility","title":"Accessibility","description":"These checks highlight opportunities to [improve the accessibility of your web app](https://developers.google.com/web/fundamentals/accessibility). Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged.","score":0.6,"manualDescription":"These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://developers.google.com/web/fundamentals/accessibility/how-to-review)."},{"id":"best-practices","title":"Best Practices","score":0.62},{"id":"seo","title":"SEO","description":"These checks ensure that your page is optimized for search engine results ranking. There are additional factors Lighthouse does not check that may affect your search ranking. [Learn more](https://support.google.com/webmasters/answer/35769).","score":0.98,"manualDescription":"Run these addi
{"lhrSlim":[{"id":"performance","title":"Performance","score":0.18},{"id":"accessibility","title":"Accessibility","description":"These checks highlight opportunities to [improve the accessibility of your web app](https://developers.google.com/web/fundamentals/accessibility). Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged.","score":0.6,"manualDescription":"These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://developers.google.com/web/fundamentals/accessibility/how-to-review)."},{"id":"best-practices","title":"Best Practices","score":0.62},{"id":"seo","title":"SEO","description":"These checks ensure that your page is optimized for search engine results ranking. There are additional factors Lighthouse does not check that may affect your search ranking. [Learn more](https://support.google.com/webmasters/answer/35769).","score":0.98,"manualDescription":"Run these addi
{"lhrSlim":[{"id":"performance","title":"Performance","score":0.19},{"id":"accessibility","title":"Accessibility","description":"These checks highlight opportunities to [improve the accessibility of your web app](https://developers.google.com/web/fundamentals/accessibility). Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged.","score":0.6,"manualDescription":"These items address areas which an automated testing tool cannot cover. Learn more in our guide on [conducting an accessibility review](https://developers.google.com/web/fundamentals/accessibility/how-to-review)."},{"id":"best-practices","title":"Best Practices","score":0.62},{"id":"seo","title":"SEO","description":"These checks ensure that your page is optimized for search engine results ranking. There are additional factors Lighthouse does not check that may affect your search ranking. [Learn more](https://support.google.com/webmasters/answer/35769).","score":0.98,"manualDescription":"Run these addi