Category Archives: Web development

8 easy steps to install SassBeautify on Sublime Text 3

1) install ruby
2) ruby –version: ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]
3) gem install sass
4) sass –version: Ruby Sass 3.5.6
5) sass-convert –version: Ruby Sass 3.5.6
6) Settings Users:
// How many spaces to use for each level of indentation. “t” means use hard tabs.
“indent”: 2,
// Use single quotes everywhere
“useSingleQuotes”: true
7) Settings Keymap:
“keys”: [“alt+w”], “command”: “sass_beautify”
8) Go to any sass file, Click “alt+w” and enjoy!

Fix bug Foundation 6 doesn’t show Filename when choosing file

$(document).on('change', '[type=file]', function () {
    var $me = $(this),
        classFileName = 'file-name',
        $fileNameContainer = $'.' + classFileName),
        fileName = baseName($me.get(0) && $(this).get(0).value),
        maxLength = 20;
    if (fileName.length > maxLength) {
        fileName = fileName.substring(0, maxLength - 1) + '...';
    if (isEmpty($fileNameContainer)) {
        $fileNameContainer = $('<span class="' + classFileName + '">' + fileName + '</span>');
    } else {

Simple Captcha in PHP

This captcha is simple and can use for any website ^^

require_once BASE_PATH . '/Code/claviska/simple-php-captcha.php';
class Captcha {
     * Document:
    public static function checkCaptcha () {
        $isSuccess = FALSE;
        if (
            empty($_POST['simple_captcha_client']) === FALSE &&
            empty($_SESSION['simpleCaptcha']['code']) === FALSE &&
            strtolower($_POST['simple_captcha_client']) == strtolower($_SESSION['simpleCaptcha']['code'])
        ) {
            $isSuccess = TRUE;
        return $isSuccess;
    public static function generateCaptcha () {
        $_SESSION['simpleCaptcha'] = simple_php_captcha([
            'min_length' => 6,
            'max_length' => 6,
            'characters' => '123456789'
        return $_SESSION['simpleCaptcha']['image_src'];
    public static function showCaptcha ($class = NULL) {
        return '<div class="captcha-holder ' . $class . '"><img src="' . Captcha::generateCaptcha() . '" class="captcha-img" /><input type="text" name="simple_captcha_client" placeholder="' . convertCase(trans('validation.enter_captcha'), 3) . '" /><a data-href="' . BASE_URL . '/captcha/reset" class="captcha-refresh"><i class="icons fi-refresh"></i></a></div>';
class Default_CaptchaController {
    function resetAction() {
        require_once BASE_PATH . '/Code/Captcha.php';
        echo Captcha::generateCaptcha();
$('.captcha-refresh').on('click', function () {
	var $me = $(this);
		url: $(this).data('href')
	.done(function(src) {
		$me.closest('.captcha-holder').find('.captcha-img').attr('src', src);
.captcha-holder {
    &> * {
        display: inline-block;
        width: auto;
        height: 39px;
    &> input {
        width: 125px;
    .captcha-refresh {
        cursor: pointer;
        .icons {
            @include font-size(22px);
            margin-left: 5px;
            position: relative;
            top: 3px;

Continue reading Simple Captcha in PHP

Login bằng php-jwt thay cho session, cookie truyền thống


composer require firebase/php-jwt:dev-master
composer require zendframework/zend-config:~2.3
composer require zendframework/zend-http:~2.3

Tham khảo: sitepoint Continue reading Login bằng php-jwt thay cho session, cookie truyền thống

Gulp run as series of tasks

// task cleanDist
gulp.task('cleanDist', function(cb) {
  return del([
// task copy-local-files: require 'cleanDist' task
gulp.task('copy-local-files', ['cleanDist'], function(cb) {
  return gulp.src('./../config/local/**/*').pipe(gulp.dest('./www'));
// task lint: require 'copy-local-file' task
gulp.task('lint', ['copy-local-files'], function() {
  return gulp.src(paths.js)

Bonus: Ionic run task before server and after serve: config in ionic.project file

  "name": "songpham",
  "app_id": "20002005",
  "gulpDependantTasks": [ // before serve
  "gulpStartupTasks": [ // after serve
  "watchPatterns": [

Fix bug MSBUILD : error MSB3428: Could not load the Visual C++ component “VCBuild.exe” …

So here it is. I have tested these steps multiple times on (each time) newly created Windows 7 SP1 VMs with IE8.

Scenario: I have a brand new Windows system, what to do?

[Only if it is Windows 7 then and you don’t already] Download .NET Framework 4.5.1 and run the installer.
Download Build Tools 2015, run the build installer.
Download Visual C Build Tools 2015 Preview, run the installer, select Custom, click Next and check both SDKs (8 and 10), click Next and then Install.
Launch regedit Navigator to HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0. Add string key VCTargetsPath key, set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140
npm config set GYP_MSVS_VERSION 2015
Download and install latest node.js.
Download and install Python 2.7.x.
Open cmd and run npm config set msvs_version 2015 –global.

Hopefully it is a temporary registry fix and they will fix it before Build Tools get out of Technical Preview status. Out of 4 times it created that registry value once.

Start > Run > cmd (and press Ctrl+Shift+Enter to Run as Administrator):
For 64-bit Windows

:: copy paste this command and press enter
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7 /v 14.0 /t REG_EXPAND_SZ /d ^%programfiles(x86)^%"\Microsoft Visual Studio 14.0\\"

For 32-bit Windows

:: copy paste this command and press enter
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7 /v 14.0 /t REG_EXPAND_SZ /d ^%programfiles^%"\Microsoft Visual Studio 14.0\\"

Now install the package like npm install selenium-webdriver and it should work!

My installation is not brand new, I had some related stuff installed and now I am getting MSB4019 or MSB8020.

This means somehow you have incorrect version of msbuild in PATH. To fix that, put C:\Program Files (x86)\MSBuild\14.0\Bin; at the beginning of PATH under System Environment Variables. To do it quickly (without making permanent change), run SET PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin;%PATH% in command prompt in case of 64-bit Windows or %ProgramFiles%\MSBuild\14.0\Bin; in case of 32-bit Windows. Then run your intended npm install command.

Finally, what to expect?

Expect every package which requires C/C++ code compilation at the time of installation to succeed on Windows, exactly as they compile at installation time on Unix-like operating systems, except those which are not supporting Windows at all (yet?) such as node-gd. For such packages, you can find their repository URL on package’s page and find the Windows support status in their issue tracker.

From issue in “Windows users are not happy”