Skip to content

Instantly share code, notes, and snippets.

View baorv's full-sized avatar
🎯
Focusing

Bob Roan baorv

🎯
Focusing
  • Mageplaza
  • Hanoi, Vietnam
View GitHub Profile
var enterInput = document.getElementsByTagName("input")[0];
function getCurrent(){
var current = null;
for (i = 0; i < 99; i ++) {
current = document.getElementById("nhwMiddlegwt-uid-" + i);
if (current != null) break;
}
return current;
}
function setCurrent(){
#Setup mailer in Yii2:
'mail' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@backend/mail',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.gmail.com',
'username' => 'username@gmail.com',
'password' => 'password',
.jq-stars {
display: inline-block;
}
.jq-rating-label {
font-size: 22px;
display: inline-block;
position: relative;
vertical-align: top;
font-family: helvetica, arial, verdana;
<?php
// You may need to use this classes
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Illuminate\Pagination\Paginator;
// Searching in segments Model, with pagination, ordering, sorting and searching.
$segments = Segment::where('segmentProviderName', $provider); // first where condition
$segmentStatuses = config('constants.segment.status');
@baorv
baorv / install virtualenv ubuntu 16.04.md
Created March 22, 2018 09:22 — forked from Geoyi/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@baorv
baorv / install-php7.2-mcrypt.sh
Created April 24, 2018 03:35 — forked from arzzen/install-php7.2-mcrypt.sh
Install PHP 7.2 MCrypt extension
#
# Check version php and pecl
#
php -v # if default php is not 7.2 then use /usr/bin/php7.2 instead php
pecl version
#
# Install mcrypt extension
# see http://pecl.php.net/package-info.php?package=mcrypt&version=1.0.1
#
@baorv
baorv / requirements.php
Created April 26, 2018 11:02
Check compatible wordpress
<?php
define('WP_USE_THEMES', true);
require_once(dirname(__FILE__) . '/wp-load.php');
global $wpdb;
global $wp_version;
$requirements = [
[
'min' => '3.2',
'max' => '10',
@baorv
baorv / postfix-dovecot-ubuntu14.04.sh
Created May 4, 2018 05:15 — forked from haisum/postfix-dovecot-ubuntu14.04.sh
Automated bash script to setup dovecot postfix mysql email server on ubuntu 14.04
#!/usr/bin/env bash
#####
# Script to install postfix
#####
DOMAIN="example.com"
EMAIL="haisum@example.com"
PASSWORD="example.com1*"
@baorv
baorv / centos_mail_bootstrap.sh
Created May 4, 2018 06:19 — forked from cou929/centos_mail_bootstrap.sh
Postfix and dovecot setup script for CentOS (instead of sendmail)
#! /bin/sh
# postfix and dovecot setup script (instead of sendmail)
# based on http://centossrv.com/postfix.shtml
echo "### install postfix via yum if not exist"
if [ ! -e /etc/postfix/main.cf ]
then
sudo yum -y install postfix
else
@baorv
baorv / CheckForMaintenanceMode.php
Created May 7, 2018 07:57 — forked from harini-ua/CheckForMaintenanceMode.php
Custom middleware Laravel 5 check for maintenance mode.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Routing\Route;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Original;