Skip to content

Instantly share code, notes, and snippets.

View hoangsetup's full-sized avatar
🎯
Work until you no longer have to represent yourself.!

Hoang Dinh hoangsetup

🎯
Work until you no longer have to represent yourself.!
View GitHub Profile
@hoangsetup
hoangsetup / FontFace.js
Created March 2, 2016 08:53
Optimizing web fonts with Font Load Events API
if(typeof FontFace === 'function') {
var font = new FontFace('FontAwesome', 'url('+ config.url_dashboard +'widget/fonts/fontawesome-webfont.woff?v=4.2.0)', {});
console.log('Time start FontFace: ' + (Date.now() - time_start) );
font.load().then(function() {
console.log(('Time done FontFace: ' + (Date.now() - time_start) );
});
}
#!/usr/bin/env bash
# Updating packages
apt-get update
# ---------------------------------------
# Apache Setup
# ---------------------------------------
# Installing Packages
Feature branches(topic branches)
Tách từ: develop
Merge vào: develop
Naming convention: tự do, ngoại trừ master, develop, release-*, hotfix-*
Feature branches (hay còn gọi là topic branches) được sử dụng để phát triển các feature mới phục vụ cho release sau này. Khi bắt đầu phát triển một chức năng, có thể chưa rõ được thời điểm chức năng đó được tích hợp vào hệ thống và release. Feature branch sẽ tồn tại trong quá trình chức năng được phát triển, cuối cùng sẽ được merge lại vào develop (khi quyết định lần release tới bao gồm chức năng đó) hoặc bị bỏ đi (khi thấy chức năng không còn cần thiết).
Về cơ bản thì feature branches chỉ tồn tại ở repos của developers, chứ ko phải ở origin.
Tạo feature branch
$ git checkout -b myfeature develop
Merge vào develop
$ git checkout develop
jQuery.notification = (function ($, window) {
var W3CNotification = (function () {
// Safari 6+ Firefox 22+
if (window.Notification && window.Notification.permissionLevel || window.Notification.permission) return window.Notification;
var webkitNotifications = window.webkitNotifications;
// Non Webkit browsers
if (!webkitNotifications) return (function () {
var mockWebkitNotifications = {};
@hoangsetup
hoangsetup / SSL_Certificate.sh
Created March 14, 2016 08:08
Create a Self Signed SSL Certificate
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/example.com/apache.key –out /etc/apache2/ssl/example.com/apache.crt
https://www.digitalocean.com/community/tutorials/how-to-set-up-multiple-ssl-certificates-on-one-ip-with-apache-on-ubuntu-12-04
@hoangsetup
hoangsetup / millisecondsToStr.js
Created August 11, 2016 02:43
Milliseconds to human string. ex: 2 days ago.
function millisecondsToStr(milliseconds) {
// TIP: to find current time in milliseconds, use:
// var current_time_milliseconds = new Date().getTime();
function numberEnding(number) {
return (number > 1) ? 's' : '';
}
var temp = Math.floor((Date.now() - milliseconds) / 1000);
var years = Math.floor(temp / 31536000);
if (years) {
return years + ' year' + numberEnding(years);
@hoangsetup
hoangsetup / http-status-codes-json.json
Created October 29, 2016 17:44
Nothing more, nothing less than the IANA registered HTTP status codes in JSON format.
{
"100": "Continue",
"101": "Switching Protocols",
"102": "Processing",
"200": "OK",
"201": "Created",
"202": "Accepted",
"203": "Non-Authoritative Information",
"204": "No Content",
"205": "Reset Content",
@hoangsetup
hoangsetup / gist:fcefa30926f57fd3ebbcb512e5b0121d
Created December 11, 2016 04:58 — forked from learncodeacademy/gist:ebba574fc3f438c851ae
Nginx Node Frontend / Load Balancer / Static Assets Caching
upstream project {
server 22.22.22.2:3000;
server 22.22.22.3:3000;
server 22.22.22.5:3000;
}
server {
listen 80;
location / {
@hoangsetup
hoangsetup / activemq.xml
Created December 17, 2016 09:42 — forked from tc/activemq.xml
Not working ActiveMQ conf file
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0