Skip to content

Instantly share code, notes, and snippets.

View Meldiron's full-sized avatar
🔥

Matej Bačo Meldiron

🔥
View GitHub Profile
let pubAPI; //je nastavene v momente ked sa logne po FB, je to nastavene zasadne pred tym ako je vyvolane changeTitle()
let dbDays; //je nastavene pred changeTitle, precita hodnotu z DB..
function changeTitle() {
if(pubAPI) {
let date1 = new Date();
var date2 = new Date("2018-06-29 00:00:00");
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
CREATE TABLE phonebook (
phone VARCHAR(20) NOT NULL,
fname VARCHAR(50) NOT NULL,
lname VARCHAR(50) NOT NULL,
email VARCHAR(100),
state VARCHAR(50) NOT NULL,
city VARCHAR(50),
age INT
);
x-swagger-router-controller: products_ctrl
get:
tags:
- Catalog
summary: Get products object
description: You can filter list by currency, category and language
operationId: searchProducts
parameters:
- name: lang_id
in: query
@Meldiron
Meldiron / app.ts
Last active August 1, 2021 11:01
Typescript: Get current weekdays
// v1.0.1
// consts
const weekInMs = 1000 * 60 * 60 * 24 * 7;
const dayInMs = 1000 * 60 * 60 * 24;
// main function
const getWeekArray = (currentDate: Date, page: number) => {
if (page > 0) {
currentDate = new Date(currentDate.getTime() + weekInMs * page); // Add X weeks where X is page
@Meldiron
Meldiron / app.ts
Created August 16, 2021 10:07
Typescript snippet for sync-like function execution in Appwrite
// This snippets expect that your functions use JSON as both input and output
// Connect to appwrite, should be globaly shared
let sdk = new Appwrite();
sdk
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.setProject("5df5acd0d48c2"); // Your project ID
// Shared type for strict type definition
@Meldiron
Meldiron / offset.csv
Last active January 10, 2022 12:06
Offset pagination article data
Offset pagination (ms)
0% offset 3.73
10% offset 52.39
20% offset 96.83
30% offset 144.13
40% offset 216.06
50% offset 257.71
60% offset 313.06
70% offset 371.03
80% offset 424.63
@Meldiron
Meldiron / offset_and_cursor.csv
Created January 10, 2022 12:07
Offset pagination article data (2)
Offset pagination (ms) Cursor pagination (ms)
0% offset 3.73 6.27
10% offset 52.39 4.07
20% offset 96.83 5.15
30% offset 144.13 5.29
40% offset 216.06 6.65
50% offset 257.71 7.26
60% offset 313.06 4.61
70% offset 371.03 6.00
80% offset 424.63 5.60
@Meldiron
Meldiron / appwrite-categories.ts
Created January 19, 2022 10:12
Almost Netflix Web - Snippets
export type AppwriteCategory = {
title: string;
queries: string[];
orderAttributes: string[];
orderTypes: string[];
collectionName?: string;
}
export const AppwriteMovieCategories: AppwriteCategory[] = [
{
@Meldiron
Meldiron / backup.sh
Last active June 18, 2024 15:21
Backup and Restore Appwrite, the lazy way 🐌
# Make sure to stop Appwrite before this backup,
# and make sure you have enough space on the machine.
# After backing up, make sure there is a file in 'backups/backup-___.tar.gz'.
# Also please check size of this file, it should be at least 5kb, even for small instances.
docker run --rm \
-v appwrite_appwrite-mariadb:/backup/appwrite-mariadb \
-v appwrite_appwrite-redis:/backup/appwrite-redis \
-v appwrite_appwrite-cache:/backup/appwrite-cache \
@Meldiron
Meldiron / docker-compose.yml
Last active March 16, 2022 09:23
File not found fix
version: '3'
services:
traefik:
image: traefik:2.5
container_name: appwrite-traefik
command:
- --providers.file.directory=/storage/config
- --providers.file.watch=true
- --providers.docker=true
- --providers.docker.exposedByDefault=false