Skip to content

Instantly share code, notes, and snippets.

View tdchien's full-sized avatar
🛴
Working hard

Chien Tran tdchien

🛴
Working hard
View GitHub Profile
@tdchien
tdchien / list extensions.vscode
Created October 21, 2017 16:50
List of favorites extensions using with Microsoft Visual Studio Code
alefragnani.project-manager
Compulim.compulim-vscode-closetag
donjayamanne.githistory
EditorConfig.EditorConfig
emmanuelbeziat.vscode-great-icons
felixfbecker.php-debug
felixfbecker.php-intellisense
felixfbecker.php-pack
ikappas.phpcs
joelday.docthis
@tdchien
tdchien / PDO Binding param.php
Created October 23, 2017 07:40
PDO Binding param.php
<?php
$dbh = null;
try {
$dbh = new PDO('mysql:host=localhost;dbname=webcms', 'webcms', 'webcms');
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
@tdchien
tdchien / User Setting.vscode
Last active October 27, 2017 08:20
My setting for VSCode
{
"editor.fontSize": 14,
"editor.lineHeight": 23,
"editor.fontFamily": "'Droid Sans Mono', Consolas, monospace, 'Courier New'",
"files.eol": "\n",
// php-cs-fixer
"php-cs-fixer.executablePath": "php-cs-fixer",
"php-cs-fixer.executablePathWindows": "php-cs-fixer.bat", //eg: php-cs-fixer.bat
"php-cs-fixer.onsave": false,
@tdchien
tdchien / EventServiceProvider.php
Created November 17, 2016 14:53
Laravel 5 - Log DB query
public function boot(DispatcherContract $events)
{
parent::boot($events);
$path = storage_path().'/logs/query.log';
\Event::listen('illuminate.query', function($sql, $bindings, $time) use($path) {
// Uncomment this if you want to include bindings to queries
//$sql = str_replace(array('%', '?'), array('%%', '%s'), $sql);
//$sql = vsprintf($sql, $bindings);
$time_now = date('Y-m-d H:i:s');
@tdchien
tdchien / Preferences.sublime-settings
Last active December 31, 2017 07:41
Sublime Text 3 - User setting
{
"color_scheme": "Packages/Agila Theme/Agila Dracula.tmTheme",
"default_line_ending": "unix",
"detect_indentation": true,
"detect_slow_plugins": false,
"drag_text": false,
"draw_white_space": "all",
"fallback_encoding": "UTF-8",
"font_size": 11,
"highlight_line": false,
@tdchien
tdchien / OpenWithSublimeText3.bat
Created May 20, 2018 14:29 — forked from roundand/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@tdchien
tdchien / OpenGitBashHere.bat
Created May 27, 2018 09:11
Get context menu Open Git bash here on window 7
@echo off
SET gbPath=d:\programs\git\git-bash.exe
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\git_bash" /t REG_SZ /v "" /d "Open Git bash here" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\git_bash" /t REG_EXPAND_SZ /v "Icon" /d "%gbPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\git_bash\command" /t REG_SZ /v "" /d "%gbPath%" /f
@reg add "HKEY_CLASSES_ROOT\Directory\background\shell\git_bash" /t REG_SZ /v "" /d "Open Git bash here" /f
@reg add "HKEY_CLASSES_ROOT\Directory\background\shell\git_bash" /t REG_EXPAND_SZ /v "Icon" /d "%gbPath%,0" /f
@tdchien
tdchien / Visual C++ for php.md
Last active June 20, 2018 08:41
Visual C++ collection for multiply php version on window

VC11, VC14 & VC15

More recent versions of PHP are built with VC11, VC14 or VC15 (Visual Studio 2012, 2015 or 2017 compiler respectively) and include improvements in performance and stability.

  • The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012 x86 or x64 installed
  • The VC14 builds require to have the Visual C++ Redistributable for Visual Studio 2015 x86 or x64 installed
  • The VC15 builds require to have the Visual C++ Redistributable for Visual Studio 2017 x64 or x86 installed

TS and NTS

TS refers to multithread capable builds. NTS refers to single thread only builds. Use case for TS binaries involves interaction with a multithreaded SAPI and PHP loaded as a module into a web server. For NTS binaries the widespread use case is interaction with a web server through the FastCGI protocol, utilizing no multithreading (but also for example CLI).

VC9 Packages (Visual C++ 2008 SP1)

@tdchien
tdchien / rambox_zalo.js
Last active August 24, 2019 03:34
Intergrate zalo with Rambox. This script is used update unread message for zalo on rambox
function checkUnread() {
console.log('checkUnread run');
var msg = document.getElementById("message-tab");
var img = msg.querySelector(".tab-red-dot");
if ((img == null) || (img == undefined)) {
// rambox.clearUnreadCount();
document.title = originalTitle;
return;
}
var src = img.attributes["src"];

Keybase proof

I hereby claim:

  • I am tdchien on github.
  • I am chientd (https://keybase.io/chientd) on keybase.
  • I have a public key ASCa5fOkJU0xUjPsFHxE3f-vGyxEg7Sor-cba2tQjpyOcwo

To claim this, I am signing this object: