Skip to content

Instantly share code, notes, and snippets.

View vpodk's full-sized avatar
💻
Coding ...

Valentin Podkamennyi vpodk

💻
Coding ...
View GitHub Profile
@vpodk
vpodk / komito-analytics.html
Last active December 9, 2021 06:52
Integration of Komito Analytics
<script src="https://komito.net/komito.js" async></script>
<script>
// The default configuration can be omitted and only changed properties can be included.
var _komito = _komito || {
'trackTwitter': 1, // Tracks Twitter events if widget is presented on page.
'trackFacebook': 1, // Tracks Facebook events if widget is presented on page.
'trackLinkedIn': 1, // Tracks LinkedIn events if plugin is presented on page.
'trackDownloads': 1, // Tracks files download links.
'trackOutbound': 1, // Tracks outbound links.
@vpodk
vpodk / fibonacci.js
Last active May 30, 2019 19:00
Calculating the value of the Fibonacci number.
/**
* +------------------------------------+
* | FIBONACCI TABLE |
* +------------------------------------+
* | n 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
* | xn 0 | 1 | 1 | 2 | 3 | 5 | 8 | 13 |
* +------------------------------------+
*
* @see https://en.wikipedia.org/wiki/Big_O_notation
* @see https://en.wikipedia.org/wiki/Fibonacci_number#Sequence_properties
@vpodk
vpodk / factorial.js
Last active May 31, 2019 20:44
Computing the factorial in JavaScript.
/**
* Computes the factorial of a given non-negative integer using iterative solution.
* @param {number} n The positive integer.
* @return {number} Returns a factorial of 'n'.
* @see https://en.wikipedia.org/wiki/Factorial
*/
function factorial(n) {
var result = 1;
for (var i = 1; i <= n; ++i) {
@vpodk
vpodk / numbers.js
Last active April 20, 2020 21:20
Manipulating numbers in JavaScript.
var n = 1;
console.log(n.toFixed(2));
// To change the number directly:
// 1. Use parentheses:
console.log((1).toFixed(2));
// 2. Use two dots:
console.log(1..toFixed(2));
// Number binary representation:
console.log(20..toString(2));