Skip to content

Instantly share code, notes, and snippets.

View vunamhung's full-sized avatar
🎯
Focusing

Hung Vu vunamhung

🎯
Focusing
View GitHub Profile
[
{
"title": "Header",
"name": "header",
"subSetting": [
{
"title": "Show search button",
"description": "Show/hide button search",
"name": "enableSearch",
"values": [
function countdown() {
var days, hours, minutes, seconds, runTimer;
var totalTime = Date.now() + 60 * 60 * (Math.random() * 14 + 10) * 1000;
var expires = Math.random() * 3;
var path = window.location.pathname;
if (!Cookies.get("cdTime")) {
Cookies.set("firstTime", Date.now(), { expires, path });
SQL Aggregation Framework
WHERE / HAVING $match
GROUP BY $group
SELECT $project
ORDER BY $sort
LIMIT $limit
sum() / count() $sum
join $lookup
@vunamhung
vunamhung / mongoose.dbref.example.js
Created September 27, 2020 03:34 — forked from hastebrot/mongoose.dbref.example.js
Example of DBRef support in Mongoose 2.0
var mongoose = require("mongoose");
var Schema = mongoose.Schema;
mongoose.connect("127.0.0.1", "mongoose_dbref", 27017);
var PersonSchema = new Schema({
name : String
, age : Number
, stories : [{ type: Schema.ObjectId, ref: 'Story' }]
});
var StorySchema = new Schema({
@vunamhung
vunamhung / scrollToEl.js
Created August 17, 2020 04:17 — forked from benhatsor/scrollToEl.js
Smooth scroll to element - Pure JS
function scrollToEl(el) {
var rect = el.getBoundingClientRect(),
scrollTop = window.pageYOffset || document.documentElement.scrollTop,
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
elTop = rect.top + scrollTop,
elLeft = rect.left + scrollLeft;
window.scrollTo({
top: elTop,
left: elLeft,
@vunamhung
vunamhung / clamav-mac.md
Created May 5, 2020 09:09 — forked from Uchean/clamav-mac.md
Get ClamAV running on Mac OS X (using Homebrew)

Get ClamAV running on Mac OS X (using Homebrew)

The easiest way to get the ClamAV package is using Homebrew

$ brew install clamav

Before trying to start the clamd process, you'll need a copy of the ClamAV databases.

Create a freshclam.conf file and configure as so