Skip to content

Instantly share code, notes, and snippets.

View winzaa123's full-sized avatar
๐Ÿ™Š
Relax ~*

win winzaa123

๐Ÿ™Š
Relax ~*
  • Phuket, Thailand
View GitHub Profile
@winzaa123
winzaa123 / cache.js
Created April 21, 2020 02:48 — forked from haimrait/cache.js
node-redis-mongo - final cache
const mongoose = require("mongoose");
const redis = require("redis");
const util = require("util");
const keys = require("../config/keys");
const client = redis.createClient({
host: keys.redisHost,
port: keys.redisPort,
retry_strategy: () => 1000
});
@winzaa123
winzaa123 / generate-pushid.js
Last active September 29, 2019 09:31 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@winzaa123
winzaa123 / header.json
Created September 6, 2019 12:44
Header firebase cloud function example
{
"host": "us-central1-XXX-XXX-XXX.cloudfunctions.net",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36",
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"accept-encoding": "gzip",
"accept-language": "en-US,en;q=0.9,th-TH;q=0.8,th;q=0.7",
"cache-control": "no-cache, no-store",
"cdn-loop": "Fastly",
"fastly-client-ip": "CLIENTXXX_IP",
"fastly-ff": "s48hDkrIORDrAz3sjuyh5gIWcInqIjSROZ47KAY+w/I=!SIN!cache-sin18042-SIN",
@winzaa123
winzaa123 / modal.vue
Last active February 25, 2019 06:16
modal Promise Vue
<template>
<div class="modal" :class="[{'show fade':dialogConfirm}]" :style="{display: dialogConfirm?'block':'none' }">
<div class="modal-backdrop" :class="[{'show fade':dialogConfirm}]" @click="cancel"></div>
<div class="modal-dialog" @click="cancel">
<div class="modal-content" style="z-index: 1050;">
<header class="modal-header">
<p class="modal-title">{{ title }}</p>
</header>
<section class="modal-body" v-show="!!message">
{{ message }}