Skip to content

Instantly share code, notes, and snippets.

View faizalmansor's full-sized avatar
🎯
Focusing on making the world a better place

Osh faizalmansor

🎯
Focusing on making the world a better place
View GitHub Profile
@faizalmansor
faizalmansor / yii2-working-with-databases-demo-table.sql
Last active August 29, 2015 14:20
Yii 2.0 - Working with Databases demo table
CREATE TABLE `country` (
`code` CHAR(2) NOT NULL PRIMARY KEY,
`name` CHAR(52) NOT NULL,
`population` INT(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8
@faizalmansor
faizalmansor / yii2-working-with-databases-demo-table-seed.sql
Last active August 29, 2015 14:20
Yii 2.0 - Working with Databases demo table seed
INSERT INTO `country` VALUES ('AU','Australia',18886000);
INSERT INTO `country` VALUES ('BR','Brazil',170115000);
INSERT INTO `country` VALUES ('CA','Canada',1147000);
INSERT INTO `country` VALUES ('CN','China',1277558000);
INSERT INTO `country` VALUES ('DE','Germany',82164700);
INSERT INTO `country` VALUES ('FR','France',59225700);
INSERT INTO `country` VALUES ('GB','United Kingdom',59623400);
INSERT INTO `country` VALUES ('IN','India',1013662000);
INSERT INTO `country` VALUES ('RU','Russia',146934000);
INSERT INTO `country` VALUES ('US','United States',278357000);
@faizalmansor
faizalmansor / yii2-sample-project-database.sql
Last active August 29, 2015 14:21
Yii 2.0 - Sample Project Database
CREATE TABLE IF NOT EXISTS `catalog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`product_name` varchar(50) NOT NULL,
`product_description` text NOT NULL,
`photo` varchar(50) DEFAULT NULL,
`price` float(4,2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
'urlManager' => [
'class' => 'yii\web\UrlManager',
'showScriptName' => false,
'enablePrettyUrl' => true,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
],
@faizalmansor
faizalmansor / ExampleController.php
Created March 8, 2016 03:00
Yii2 Access Control to make all actions in controller required login by default
<?php
namespace app\controllers;
use yii\filters\AccessControl;
use yii\web\Controller;
class ExampleController extends Controller
{
public function behaviors()
@faizalmansor
faizalmansor / Vagrantfile
Created March 15, 2016 12:20
Vagrantfile for official Freebsd vagrant box
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.guest = :freebsd
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true
config.vm.box = "freebsd/FreeBSD-10.2-STABLE"
config.ssh.shell = "sh"
config.vm.base_mac = "080027D14C66"
@faizalmansor
faizalmansor / Vagrantfile
Created April 18, 2016 08:10
Vagrantfile for oshpilaf/ubuntu1404-php52 box
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "oshpilaf/ubuntu1404-php52"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder ".", "/var/www", owner: "www-data", group: "www-data", :mount_options => ["dmode=777", "fmode=666"]
end
@faizalmansor
faizalmansor / Vagrantfile
Created April 19, 2016 11:33
Vagrantfile for oshpilaf/devbox-centos7
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@faizalmansor
faizalmansor / Vagrantfile
Created April 19, 2016 12:38
Vagrant file for myopensoft/devbox
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "myopensoft/devbox"
config.vm.network "private_network", ip: "192.168.33.10"
@faizalmansor
faizalmansor / web.xml
Created May 27, 2016 10:27
web.xml for UrlRewriteFilter in CFWheels 1.4 running on Lucee 5
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>