Skip to content

Instantly share code, notes, and snippets.

View Stas-Buzunko's full-sized avatar

Stas Stas-Buzunko

View GitHub Profile
@Stas-Buzunko
Stas-Buzunko / decode-firebase-database-key.js
Last active January 12, 2021 15:14
retrieve timestamp from firebase database key
// this is how firebase generates keys
// https://github.com/firebase/firebase-js-sdk/blob/master/packages/database/src/core/util/NextPushId.ts
const decodeFirebaseKey = key => {
// chars firebase use for generating keys
const CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
let timestamp = 0
// we only need to decode first 8 symbols
@Stas-Buzunko
Stas-Buzunko / index.js
Last active December 13, 2022 23:55
Script for Board Game Arena 6 nimmt! game
let array = Array(104).fill(null).map((x,y) => y + 1)
let playerHandCardsNumber = 10
setInterval(() => {
const table = document.getElementById('cards_on_table')
for (let i = 0; i < table.children.length; i++) {
const el = table.children[i]
const numberOnCard = +el.getAttribute('id').replace('card_', '')
if (array.includes(numberOnCard)) {
<strong>Watch the match live <strong>today, <span id="time-holder"></span>.</strong></strong>
<strong>Watch the match live <strong>next month, <span id="time-holder-1"></span>.</strong></strong>
<strong>Watch the match live <strong>in 2 month, <span id="time-holder-2"></span>.</strong></strong>
<script type="text/javascript">
(function() {
const date = new Date('8/2/2018 7:00:00 PM UTC');
const language = [];
@Stas-Buzunko
Stas-Buzunko / gist.js
Last active August 27, 2018 20:33
date auto convert for chess.com articles
// usage
// 1) place an html element with id="time-holder" anywhere, like <span id="time-holder"></span>
// 2) place script below at the end of body tag
// 3) pass date in format 8/2/2018 7:00:00 PM UTC
// 4) pass language, keep empty for en
// 5) set whether to replace commas
// 6) in case you have mulptiple dates on the same page
// a) simply modify id in html from time-holder to time-holder-X but keep it unique
// b) copy paste this script and change in the last line of this script from time-holder to time-holder-X