Skip to content

Instantly share code, notes, and snippets.

View teepluss's full-sized avatar

Maximus teepluss

View GitHub Profile
try{
// ...
}
catch( Exception $e )
{
if ($e instanceof UserNotFoundException) {
// it's an instance of UserNotFoundException, return accordingly
}
elseif ($e instanceof SomethinElseException) {
// it's an instance of SomethinElseException, return accordingly
@teepluss
teepluss / Example
Last active August 29, 2015 14:14
Trait Extending
<?php
trait Name {
function say($word)
{
return $word;
}
}
@teepluss
teepluss / index.js
Last active October 26, 2015 12:07
React Redux Example
import React, { PropTypes } from 'react'
import ReactDOM from 'react-dom'
import { createStore } from 'redux'
import { Provider, connect } from 'react-redux'
import _ from 'lodash'
// Main component.
class Main extends React.Component {
render() {
return (
@teepluss
teepluss / ProductControllerTest.php
Created November 24, 2015 17:08 — forked from ethaizone/ProductControllerTest.php
Laravel 5.1 - Run testcase with real model in memory.
<?php
use Illuminate\Foundation\Testing\DatabaseMigrations;
class ProductControllerTest extends TestCase
{
use DatabaseMigrations;
protected $testSubject = null;
@teepluss
teepluss / example.php
Last active May 7, 2019 15:54
Example CloudSearch
<?php
use Aws\CloudSearch\CloudSearchClient;
use Aws\CloudSearchDomain\CloudSearchDomainClient;
// http://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-cloudsearchdomain.html
$client = CloudSearchDomainClient::factory(array(
//'endpoint' => 'https://doc-example-xxx.ap-southeast-1.cloudsearch.amazonaws.com',
'endpoint' => 'https://search-example-xxx.ap-southeast-1.cloudsearch.amazonaws.com',
@teepluss
teepluss / .bowerrc
Last active August 10, 2018 08:20
Config "AdminLTE" with Laravel Elixir
{
"directory": "./resources/assets/vendor"
}
@teepluss
teepluss / gist:be483a9bc726b63ab5152ce9b24856b4
Created September 20, 2016 04:11
Loop Array Multi Dimensions
$data = [];
$data[0] = ['S', 'M', 'L'];
$data[1] = ['RED', 'BLACK'];
$data[2] = ['IRON', 'COTTON'];
$data[3] = ['STRONG', 'WEAK'];
$data[4] = ['MAJOR', 'MINOR'];
$data[5] = ['XX', 'YY'];
class Possible
{