This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Danh sach tat ca controller va method trong HMVC CodeIgniter | |
* modules/* | |
* application/controllers/* | |
*/ | |
function structure() | |
{ | |
$hmvc = array(); | |
foreach(glob(APPPATH . 'controllers/*') as $controller) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Tính tuổi */ | |
function calculateAge (birthDate, otherDate) { | |
birthDate = new Date(birthDate); | |
otherDate = new Date(otherDate); | |
var years = (otherDate.getFullYear() - birthDate.getFullYear()); | |
if (otherDate.getMonth() < birthDate.getMonth() || otherDate.getMonth() == birthDate.getMonth() && otherDate.getDate() < birthDate.getDate()) { | |
years--; | |
} | |
return years; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Độ mạnh của mật khẩu | |
^(?=.*[A-Z].*[A-Z])(?=.*[!@#$&*])(?=.*[0-9].*[0-9])(?=.*[a-z].*[a-z].*[a-z]).{8}$ | |
Kiểm tra độ mạnh của một mật khẩu thường là chủ quan nên không có câu trả lời chính xác tuyệt đối. Nhưng tôi cảm thấy đoạn regex này là một điểm khởi đầu tuyệt vời nếu bạn không muốn phải viết riêng hàm kiểm tra độ mạnh mật khẩu của bạn từ đầu. | |
2. Mã màu Hex | |
\#([a-fA-F]|[0-9]){3, 6} | |
Mã màu hex rất phố biến trong lĩnh vực phát triển web. Đoạn regex này có thể được sử dụng để lấy mã hex phù hợp từ chuỗi bất kỳ cho bất cứ mục đích nào. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
*/ | |
class ToHop | |
{ | |
public $a = array(); | |
public $n; | |
public $k; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_link($videoid) | |
{ | |
$data = file_get_contents('http://youtube.com/get_video_info?video_id=' . $videoid . '&fmt=18&asv=2&hd=1'); | |
parse_str($data , $details); | |
$my_formats_array = explode(',' , $details['adaptive_fmts']); | |
$avail_formats[] = ''; | |
$i = 0; | |
$ipbits = $ip = $itag = $sig = $quality_label = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TAB CLOSEALLOTHERS | |
SET !LOOP -9999999 | |
SET !EXTRACT_TEST_POPUP NO | |
SET !TIMEOUT_PAGE 10 | |
SET !ERRORIGNORE YES | |
SET !TIMEOUT_STEP 0.5 | |
URL GOTO=http://addmefast.com/free_points/facebook_likes | |
TAG POS=1 TYPE=DIV ATTR=TXT:Like | |
TAB T=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub MergeSheets() | |
Const NHR = 1 | |
Dim MWS As Worksheet | |
Dim AWS As Worksheet | |
Dim FAR As Long | |
Dim LR As Long | |
Set AWS = ActiveSheet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Upgrade your server’s php installation from 5.5.x to 5.6.x on Ubuntu 14.04 LTS | |
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php | |
sudo apt-get update | |
sudo apt-get install php5.6 php5.6-cli php5.6-common php5.6-curl php5.6-dev php5.6-gd php5.6-intl php5.6-json php5.6-ldap php5.6-mbstring php5.6-mcrypt php5.6-memcache php5.6-memcached php5.6-mysql php5.6-pgsql php5.6-readline php5.6-sqlite php5.6-xml php5.6-xsl libzip4 php5.6-zip | |
sudo apt-get update && apt-get upgrade | |
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php5-compat | |
sudo apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install XAMPP with the PHP Version you want to run mainly, e.g. PHP 7.2 => resides by default in Installpath\xampp\php | |
2. Copy other php Versions in Installpath\xampp\, eg PHP 5.4 in => Installpath\xampp\php5 | |
If you are lazy like me, just grab the other php folder from old xampp installations, => beneficial since the used dlls are already in the right place | |
3 Make sure every php version on her own has a working php.ini. | |
use individual error logs per version: | |
error_log="D:\xampp\php5\logs\php_error_log" | |
error_log="D:\xampp\php\logs\php_error_log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Unicode Tổ hợp 2 Dựng sẵn | |
* @param [type] $unicode_str [description] | |
* @return [type] [description] | |
*/ | |
function unicodeTH2unicodeDS($unicode_str) | |
{ | |
$unicode_str = preg_replace("/\x{0065}\x{0309}/u", "ẻ", $unicode_str); # ẻ | |
$unicode_str = preg_replace("/\x{0065}\x{0301}/u", "é", $unicode_str); # é | |
$unicode_str = preg_replace("/\x{0065}\x{0300}/u", "è", $unicode_str); # è |
OlderNewer