Protected: Postgres trigger event after crud
8 easy steps to install SassBeautify on Sublime Text 3
1) install ruby https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.5.1-2/rubyinstaller-2.5.1-2-x64.exe
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!
Protected: Tài Liệu Solution Architect đầu tiên
Protected: Làm dự án wordpress 4.9.x
Fix bug Foundation 6 doesn’t show Filename when choosing file
$(document).on('change', '[type=file]', function () { var $me = $(this), classFileName = 'file-name', $fileNameContainer = $me.next('.' + 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>'); $fileNameContainer.insertAfter($me); } else { $fileNameContainer.text(fileName); } });
Simple Captcha in PHP
This captcha is simple and can use for any website ^^
<?php require_once BASE_PATH . '/Code/claviska/simple-php-captcha.php'; class Captcha { /** * Document: https://github.com/claviska/simple-php-captcha */ 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); $.ajax({ 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; } } }
Login bằng php-jwt thay cho session, cookie truyền thống
install:
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
Protected: Editable content and change style with Jquery
Gulp run as series of tasks
// task cleanDist gulp.task('cleanDist', function(cb) { return del([ './www/js/configuration.js' ]); }); // 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) .pipe(jshint('.jshintrc')) .pipe(jshint.reporter('jshint-stylish')); });
Bonus: Ionic run task before server and after serve: config in ionic.project file
{ "name": "songpham", "app_id": "20002005", "gulpDependantTasks": [ // before serve "lint" ], "gulpStartupTasks": [ // after serve "watch" ], "watchPatterns": [ "www/**/*", "!www/lib/**/*" ] }