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) => {
@niksudan
niksudan / mc-server-setup.md
Last active December 12, 2023 20:15
How to create a new Minecraft Server with DigitalOcean

Creating a new Minecraft Server

This is a short and simple guide on how to set up a multiplayer server running the latest version of Minecraft.

This guide has been tested on Ubuntu 16.04 and 18.04.

Setup

Create a new Ubuntu droplet on DigitalOcean. Make sure it has at least 2GB of RAM, and you provide it with your SSH key.

@dehamzah
dehamzah / generate.js
Last active April 14, 2024 16:47
Generate secret key in NodeJS
require('crypto').randomBytes(48, function(err, buffer) { var token = buffer.toString('hex'); console.log(token); });
@thomd
thomd / semantic-layout.html
Last active March 29, 2024 00:27
Standard HTML5 Semantic Layout
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Title</title>
<link href="stylesheets/main.css" rel="stylesheet" />
</head>
<body>
<header>
<hgroup>