Skip to content

Instantly share code, notes, and snippets.

View ethaizone's full-sized avatar
💭
It's same on Gitlab.

Nimit Suwannagate ethaizone

💭
It's same on Gitlab.
View GitHub Profile
@ethaizone
ethaizone / git_autocommit_all.bat
Created October 18, 2013 06:58
Commit git with bat file
@echo off
echo type "commit" or "update"
cd "curl"
set GIT_PATH="C:\Program Files (x86)\Git\bin\git.exe"
set BRANCH = "origin"
:P
set ACTION=
set /P ACTION=Action: %=%
@ethaizone
ethaizone / SoftBelongsToMany.php
Last active January 3, 2016 11:09
When I want to store pivot data in pivot table. When I detach, record will delete so this can make pivot table can do soft delete. #Laravel4 #relation #belongsToMany
<?php
/**
* write by EThaiZone <ethaizone@hotmail.com>
* todo feature - about update data of pivot table
*/
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
@ethaizone
ethaizone / getGitStatus.php
Last active August 29, 2015 14:13
Add new logic for git that deploy via jenkin (multi-scm) and add as original code that I use on Laravel
<?php
/**
* Get Git Status via PHP (No execute function)
* @author Nimit Suwannagate <ethaizone@hotmail.com>
* Laravel Version
*/
function getGitStatus()
{
$branch = null;
@ethaizone
ethaizone / helper-view.php
Created January 26, 2015 14:31
Example view render as helper
<?php
if (! function_exists('view'))
{
/**
* Render view as html with layout system
* @author Nimit Suwannagate <ethaizone@hotmail.com>
*/
function view($viewName, $data = array(), $layout = 'default')
{
@ethaizone
ethaizone / helper-web-path.php
Created January 26, 2015 14:35
Lazy method but work - Helper for get baseUrl and basePath for website/webapp development
<?php
if ( ! function_exists('basePath'))
{
/**
* Get the path to the base of the install.
*
* @param string $path
* @return string
*/
@ethaizone
ethaizone / dq.php
Created March 24, 2015 07:36
Simple laravel helper - Dump Query
<?php
// write by me.
if ( ! function_exists('dq'))
{
function dq($offset = 0, $length = null, $echoOnly = false)
{
s(array_slice(DB::getQueryLog(), $offset, $length));
if ($echoOnly == false)
@ethaizone
ethaizone / array.php
Created June 11, 2015 04:05
Array collection helpers. Ported from Laravel4.
<?php
/**
* Array collection helpers
*
* Ported from Laravel4.
* By EThaiZone
*/
if ( ! function_exists('array_add'))
{
@ethaizone
ethaizone / date_thai_helper.php
Last active October 1, 2015 11:08
Date in Thai
<?php
/**
* Date function for Thai
* Lazy code version.
*
* Don't remove copyright.
*
* @author Nimit Suwannagate <ethaizone@hotmail.com>
*/
@ethaizone
ethaizone / ProductControllerTest.php
Last active November 24, 2015 17:08
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;
@ethaizone
ethaizone / mb_str_split.php
Created January 23, 2016 16:52
mb_str_split function. multibyte version of str_split.
<?php
if (!function_exists('mb_str_split')) {
/**
* Convert a multibyte string to an array
*
* @param string $string The input string.
* @param integer $split_length Maximum length of the chunk.
* @param string $encoding The encoding parameter is the character encoding.
* @return array