Skip to content

Instantly share code, notes, and snippets.

View gko's full-sized avatar
🐑
📃💨

Konstantin gko

🐑
📃💨
View GitHub Profile
const minute = 60;
const hour = minute * 60;
const day = hour * 24;
const week = day * 7;
const month = day * 30;
const year = day * 365;
/**
* Convert a date to a relative time string, such as
* "a minute ago", "in 2 hours", "yesterday", "3 months ago", etc.
@kristoferjoseph
kristoferjoseph / single-file-web-component.html
Last active November 22, 2023 01:17
Single file Web Component
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Single File Web Component</title>
</head>
<body>
<template id=single-file>
<style>
h1 {
// https://twitter.com/fermatslibrary/status/875340896379817984/photo/1
const memoizedWords: {
[Key: string]: number;
} = {};
const ALPHABET_MAPPED_TO_PRIME_NUMBERS: {
[Key: string]: number;
} = {
a: 2,
b: 3,
@illvart
illvart / 0-vscode-extensions-backup.md
Last active October 6, 2023 09:33
VSCode - Visual Studio Code extensions backup

VSCode - Visual Studio Code extensions backup

If you are use Unix/Linux create a bash script with a loop. In this case I want to backup the extensions list and install again:

First create a list of the extensions:

$ code --list-extensions > extensions.txt

Create a bash script for example with the name vscode-extension-install.sh and input the following code:

@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@jukkatupamaki
jukkatupamaki / 20190417131115_test-setup.ts
Last active June 21, 2023 07:03
How to use Knex.js in a TypeScript project
import { Knex } from 'knex'
export async function up(knex: Knex): Promise<any> {
await knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => {
table.integer('foobar');
});
}
export async function down(knex: Knex): Promise<any> {
await knex.schema.dropTable('test_setup');
#!/bin/bash
# This script takes a remote repository and merges it into
# the current one as a subdirectory
set -e
if [ -z "$1" ]
then
echo "Usage:"
@gko
gko / 01-emoji.conf
Last active April 2, 2018 21:44
Fonts config for linux(~/.config/fontconfig/conf.d/01-emoji.conf)
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- Emoji config -->
<alias>
<family>Apple Color Emoji</family>
<prefer>
<family>emoji</family>
</prefer>
</alias>
@veltman
veltman / README.md
Created September 2, 2017 12:31
SVG animation to video

Converting an SVG animation to a video with the MediaRecorder API and a hidden canvas.

Drawing frames from img elements can introduce an extra delay, so this version generates all the frames upfront and then renders them in a loop with requestAnimationFrame().

See also: Canvas animation to video

@gko
gko / Menu.html
Last active May 2, 2017 06:39
burger menu
<div class="Menu">
<div class="Menu-line"></div>
<div class="Menu-line"></div>
</div>