Skip to content

Instantly share code, notes, and snippets.

View huynhsamha's full-sized avatar

Ha huynhsamha

  • Ho Chi Minh, Vietnam
View GitHub Profile
@huynhsamha
huynhsamha / hide-froala-license.css
Last active May 23, 2022 07:02
Hide Froala license correctly without crashing editor after 11 times
div.fr-wrapper>div>a {
/* display: none !important; */
/* position: fixed; */
/* z-index: -99999 !important; */
font-size: 0px !important;
padding: 0px !important;
height: 0px !important;
}
const http = require('http');
const express = require('express');
const mongoose = require('mongoose');
const app = express();
const server = http.Server(app);
const connectionUri = 'mongodb://localhost/db_test';
mongoose
@huynhsamha
huynhsamha / app.js
Last active February 17, 2024 18:27
How to create dynamic model with a schema in mongoose
const http = require('http');
const express = require('express');
const mongoose = require('mongoose');
const app = express();
const server = http.Server(app);
const connectionUri = 'mongodb://localhost/dbtest';
mongoose
@huynhsamha
huynhsamha / FindFirst.py
Created December 15, 2018 02:27
[Python 3] - Find first match predicate in Python
"""
@param x: target to find
@param a: list of object to find target x
@param f: predicate, function map each element in a to a value with type of target
"""
def findFirst(x, a, f):
return next((i for i in a if f(i) == x), None)
a = [(1,1), (2,3), (-1,4), (3,4), (2,1), (4,5), (4,3)]
@huynhsamha
huynhsamha / xampp-nginx-ubuntu-ec2.md
Last active May 16, 2024 03:10
Config XAMPP with NGINX on Ubuntu 16.04 AWS EC2

Install NGINX

bla bla...

Install XAMPP

# Download
wget https://www.apachefriends.org/xampp-files/7.2.2/xampp-linux-x64-7.2.2-0-installer.run

# Install
chmod +x xampp-linux-x64-5.6.33-0-installer.run
@huynhsamha
huynhsamha / Nginx is unable to bind to 443.md
Last active February 1, 2023 10:15
SSH - Configure Nginx on AWS EC2
@huynhsamha
huynhsamha / prefix_calculate.py
Last active December 15, 2018 02:31
[Python 3] Calculate Prefix Expression with + - * / for number
# Calculate Prefix Expression with + - * / for number
# infix expression: 3 + 2*4 - 5
prefix = ['-', '+', 3, '*', 2, 4, 5]
# infix expression: 3 * 4 * (4 - 5 + 6/2 - 5*3) / 1 - 1
prefix = ['-' ,'*', '*', 3, 4, '/', '-', '+', '-', 4, 5, '/', 6, 2, '*', 5, 3, 1, 1]
# infix expression: ((5+6-1) * 4 / 1 + (1+2+3) * (5 * (6/1-2))) -5
prefix = ['-','+','/','*','-','+',5,6,1,4,1,'*','+','+',1,2,3,'*',5,'-','/',6,1,2,5]
@huynhsamha
huynhsamha / MongoDB_CLI.md
Last active November 10, 2018 10:47
MongoDB CLI - Common commands on SSH Linux

Start service MongoDB

sudo service mongod start

Mongo Shell

Open shell

mongo
@huynhsamha
huynhsamha / sweet-alert-dialog-colors.xml
Created October 19, 2018 00:47
Override Default Colors Sweet Alert Dialog in Android (https://github.com/pedant/sweet-alert-dialog)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--Override Sweet Alert Confirm -->
<color name="blue_btn_bg_pressed_color">#96BFD2</color>
<color name="blue_btn_bg_color">#AEDEF4</color>
<color name="button_text_color">#FFFFFF</color>
<color name="error_stroke_color">#ff4141</color>
<color name="float_transparent">#00000000</color>
<color name="gray_btn_bg_color">#bfbfbf</color>
<color name="gray_btn_bg_pressed_color">#969696</color>
@huynhsamha
huynhsamha / responsive.css
Created September 30, 2018 09:45
Template CSS file for Responsive Web Design - The Viewport
/******************************
1. 1600px
2. 1440px
3. 1280px
4. 1199px
5. 1100px
6. 1024px
7. 991px
8. 959px
9. 880px