Skip to content

Instantly share code, notes, and snippets.

Better everyday

Daniels Teddy bonniss

Better everyday
  • DT-Corp
  • Vietnam
View GitHub Profile
View gl-param-datasource.json
"labelKey": "label",
"valueKey": "value",
"data": [
"label": "Handmade",
"value": "car"
bonniss /
Created Feb 11, 2022 — forked from francoisromain/
A bash script to create a Git post-receive hook to deploy after a Git push
# source:
# and another script to delete the directories created by this script
# Call this file with `bash ./ project-name`
# - project-name is mandatory
# This will creates 4 directories and a git `post-receive` hook.
View gist:bf9d54eb06c21bf1456300f28011f400
if ("undefined" == typeof ZotataPlayUserID) var ZotataPlayUserID = "";
if ("undefined" == typeof ZotataPlayAuthKey) var ZotataPlayAuthKey = "";
if ("undefined" == typeof debug) var debug = -1 != location.hostname.indexOf("");
var VERSION = 101,
SERVER_ADDRESS = -1 != location.hostname.indexOf("") ? "" : "",
bonniss / dataset-1.json
Last active Oct 20, 2021
Dummy GA User Flows
View dataset-1.json
{"filter":{"countries":{"id":"viet-nam","name":"Việt Nam"}},"meta":{"createAt":"2021-10-20T03:04:40.373Z"},"cols":[{"level":0,"nodes":[{"pageId":"page-khach-hang-than-thiet","id":"0-page-khach-hang-than-thiet"},{"pageId":"page-ho-tro-tien-ban","id":"0-page-ho-tro-tien-ban"},{"pageId":"page-chung-khoan-upcom","id":"0-page-chung-khoan-upcom"},{"pageId":"page-sao-ke-truc-tuyen","id":"0-page-sao-ke-truc-tuyen"},{"pageId":"page-others","id":"0-page-others"}]},{"level":1,"nodes":[{"pageId":"page-khach-hang-than-thiet","id":"1-page-khach-hang-than-thiet"},{"pageId":"page-trang-chu","id":"1-page-trang-chu"},{"pageId":"page-dat-lenh","id":"1-page-dat-lenh"},{"pageId":"page-chung-khoan-phai-sinh","id":"1-page-chung-khoan-phai-sinh"},{"pageId":"page-others","id":"1-page-others"}]},{"level":2,"nodes":[{"pageId":"page-mo-tai-khoan","id":"2-page-mo-tai-khoan"},{"pageId":"page-sao-ke-truc-tuyen","id":"2-page-sao-ke-truc-tuyen"},{"pageId":"page-dang-ky-quyen-mua","id":"2-page-dang-ky-quyen-mua"},{"pageId":"page-tai-lieu-huon
bonniss /
Created Oct 8, 2021 — forked from lopspower/
Hexadecimal color code for transparency

Hexadecimal color code for transparency


How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

bonniss /
Created Jul 15, 2021 — forked from subfuzion/
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

bonniss / array.js
Last active Oct 24, 2020
Useful snippets in Javascript for up and running project. @link:
View array.js
// @link:
const from = (...args) => Array.from(...args)
const isArray = val => Array.isArray(val)
const arrayIncludes = (array, value) => array.indexOf(value) !== -1
const concat = (...args) => Array.prototype.concat.apply([], args)
export const createAndFillArray = (size, value) => Array(size).fill(value)
bonniss /
Last active Jul 12, 2021
better-sqlite3 cheatsheet


// Init new db
// If the database file does not exist, it is created
// This happens synchronously, which means you can start executing queries right away
const Database = require('better-sqlite3');
bonniss /
Created Jun 10, 2020 — forked from jesperorb/
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header: