Skip to content

Instantly share code, notes, and snippets.

View minhphong306's full-sized avatar
😄
Don't watch the clock. Do what it does! Keep going!

Phong Do minhphong306

😄
Don't watch the clock. Do what it does! Keep going!
View GitHub Profile
@minhphong306
minhphong306 / useful.php
Created February 6, 2018 14:50
PHP Useful function
// Remove special character, only Allow alphabets and numbers
function vn_to_str($str) {
$unicode = array(
'a' => 'á|à|ả|ã|ạ|ă|ắ|ặ|ằ|ẳ|ẵ|â|ấ|ầ|ẩ|ẫ|ậ',
'd' => 'đ',
'e' => 'é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ',
'i' => 'í|ì|ỉ|ĩ|ị',
'o' => 'ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ',
'u' => 'ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự',
'y' => 'ý|ỳ|ỷ|ỹ|ỵ',
@minhphong306
minhphong306 / AngularUseful.js
Created February 7, 2018 03:25
AngularJS useful snippet
// Create app with ui router
var app = angular.module('app', ['ui.router']);
// Controller
app.controller('indexCtrl', function ($scope, mainService) {
});
// Service for PHP server
app.factory('mainService', function ($http) {
@minhphong306
minhphong306 / bootstrap_useful_snippet.xxx
Created February 10, 2018 03:36
Bootstrap useful snippet
// Table
<table class="table table-hover">
<thead>
<tr>
<th>Tiêu chí</th>
<th>Kết quả</th>
</tr>
</thead>
<tbody>
<tr>
# Set auto increment for uuid column
ALTER TABLE category
ADD CONSTRAINT DF_category_id DEFAULT newid() for id
# Full calendar not display
--> add media="print" in <link rel ....
@minhphong306
minhphong306 / basicController.js
Last active May 2, 2018 10:50
AngularJS basic app + factory + controller (add, update, remove, upload image (angular-file-upload) to do with PHP
// include angular file upload (https://github.com/minhphong306/base_lib/blob/master/angular-file-upload/angular-file-upload.min.js) and ng-thumb
var app = angular.module('app', ['angularFileUpload']);
// Factory
app.factory('mainFactory', function ($http, $rootScope, $q, $log) {
var domain = "service/";
var factory = {};
factory.doAction = function (data, uri) {
return $http({
@minhphong306
minhphong306 / angularjs-bootstrap-component.html
Last active May 17, 2018 03:32
Basic HTML element with AngularJS + bootstrap
# Form element (form group)
// input
<div class="form-group">
<label class="control-label col-sm-3">Tên danh mục</label>
<div class="col-sm-9">
<input ng-model="category.add_model.name"
type="text" class="form-control"
placeholder="Nhập tên danh mục" autofocus required>
</div>
@minhphong306
minhphong306 / server.xml
Created June 5, 2018 21:35
Tomcat virtual domain config
<Host name="expenditure.hihi" appBase="webapps/JSP-Expenditure-Management"
unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Alias>expenditure.hihi</Alias>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
<Context path="" docBase=""
debug="0" reloadable="true"/>
</Host>
@minhphong306
minhphong306 / file .htaccess ở thư mục gốc
Created June 26, 2018 16:15
Combo .htaccess cho việc chuyển đổi thư mục root cho tên miền gốc
RewriteEngine On
RewriteBase /
# Thay cái /webapp bằng thư mục bạn muốn chuyển
RewriteCond %{THE_REQUEST} /webapp/([^\s?]*) [NC]
RewriteRule ^ %1 [L,NE,R=302]
# Thay cả ở đây nữa nhá
RewriteRule ^(.*)$ webapp/index.php?$1 [L,QSA]
@minhphong306
minhphong306 / db.sql
Created July 6, 2018 15:15
Database for test remove duplicate file
CREATE TABLE IF NOT EXISTS `duplicate` (
`inc_id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) COLLATE utf8_vietnamese_ci NOT NULL,
`note` varchar(200) COLLATE utf8_vietnamese_ci DEFAULT NULL,
PRIMARY KEY (`inc_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_vietnamese_ci;