Skip to content

Instantly share code, notes, and snippets.

View jovanialferez's full-sized avatar

jovanialferez

  • Hoogly
  • Davao City, Philippines
View GitHub Profile
// have this inside your Users model
public function getUserType()
{
return $this->type == 1 ? "Administrator" : "User";
}
// modify your grid as this
<?php
add_action('add_meta_boxes', 'gov_meta_box_add');
function gov_meta_box_add()
{
add_meta_box('post-meta-box-id', 'Event Type', 'gov_meta_box_cb', 'post', 'side', 'high');
add_meta_box('page-meta-box-id', 'Event Type', 'gov_meta_box_cb', 'page', 'side', 'high');
}
function gov_meta_box_cb($post)
{
$values = get_post_custom($post->ID); // error_log(json_encode($values));
<?php
/**
* @author: vojalf@gmail.com
*/
namespace common\components\storage;
/**
* A component to Store File into local storage/path.
* Just add this component to your configuration providing this class,
function myAutocomplete ($document, $timeout, $compile) {
return {
restrict: 'A',
scope: {
onSelectModel: '='
},
template: require('./autocomplete.html'),
transclude: true,
link: (scope, element, attrs) => {
$document.ready(() => {
<?php
namespace common\models;
use Yii;
use yii\behaviors\BlameableBehavior;
use yii\behaviors\TimestampBehavior;
use yii\imagine\Image;
/**
#!/bin/sh
cd /tmp
mkdir vpnht
cd vpnht
cat <<EOF > vpnht.conf
client
dev tun
proto udp
resolv-retry infinite
nobind
version: '2'
services:
mysql:
build: ./mysql
volumes_from:
- volumes_data
ports:
- "3306:3306"
environment:
server {
listen 80;
root /var/www;
index index.php index.html;
proxy_read_timeout 300;
client_max_body_size 1024M;
location / {
@jovanialferez
jovanialferez / app.scss
Last active May 30, 2018 05:51
Using custom icons in Ionic 2 or 3
@import '../theme/icons'; // that icons.scss above
@include makeIcon(mb-orders, '\e92e');
@include makeIcon(mb-home, '\e900');
@include makeIcon(mb-account, '\e901');
@jovanialferez
jovanialferez / ubuntu-docker-setup-windows-10-wsl.md
Last active December 8, 2018 14:15
my windows 10 dev setup