Skip to content

Instantly share code, notes, and snippets.

View savepong's full-sized avatar
:octocat:
savepong

Pongsiri Pisutakarathada savepong

:octocat:
savepong
View GitHub Profile
@savepong
savepong / foo.php
Created February 27, 2019 12:37
PHP Fatal Error: Allowed Memory Size Exhausted
<?php
ini_set('memory_limit', '1024M'); // or you could use 1G
<?php
/**
* @package Tags in Category
*/
/*
Plugin Name: Tags in Category
Plugin URI: https://github.com/savepong/tags-in-category
Description: Show categories child of parent category
Version: 1.0
Author: Pongsiri Chuaychoonoo
@savepong
savepong / Helpers.php
Created December 5, 2018 08:20
ฟังก์ชั่นเช็คชื่อ Route ที่กำลังเปิดอยู่
<?php
if (! function_exists('routeIsActive')) {
function routeIsActive($routes, $print = 'active'){
if (is_array($routes)) {
foreach ($routes as $route) {
if(Route::is($route)){
return $print;
}
}
@savepong
savepong / index.html
Created November 12, 2018 15:35
jQuery Input Masks
<form action="">
<div>
<label for="cc">Credit Card</label>
<!-- Set via HTML -->
<input id="cc" type="text" data-inputmask="'mask': '9999 9999 9999 9999'" />
</div>
<div>
<label for="date">Date</label>
@savepong
savepong / index.html
Created November 9, 2018 05:13
Phone Number Input
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<body>
<div class="phone-field">
(<input class="phone-input" name="phone-input" type="tel" size="1" maxlength="1" placeholder="5" autofocus="autofocus">
<input class="phone-input" name="phone-input" type="tel" size="1" maxlength="1" placeholder="5">
<input class="phone-input" name="phone-input" type="tel" size="1" maxlength="1" placeholder="5">)
<input class="phone-input" name="phone-input" type="tel" size="1" maxlength="1" placeholder="5">
<input class="phone-input" name="phone-input" type="tel" size="1" maxlength="1" placeholder="5">
<input class="phone-input" name="phone-input" type="tel" size="1" maxlength="1" placeholder="5"> -
@savepong
savepong / GitWorkflowCli.sh
Last active August 29, 2018 08:50
รวมคำสั่งสำหรับ Git Workflow
Feature branch
// ถ้าเราอยู่ใน develop แล้วก็สั่ง
git checkout -b feature/hello-world
// หรือถ้าอยู่ branch อื่นๆ ก็พิมพ์ตามคำสั่งด้านล่าง
git checkout -b feature/hello-world develop
—————————————————————————
Release branch
// ถ้าเราอยู่ใน develop แล้วก็สั่ง
git checkout -b realease/release-0.2
@savepong
savepong / SimpleContract.sol
Created August 28, 2018 04:38
Simple Smart Contract
pragma solidity ^0.4.18;
contract SimpleContract {
uint balance;
constructor() public {
// Set initial balance as 1000
balance = 1000;
}
function setBalance(uint newBalance) public {
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
@savepong
savepong / 01.md
Created June 11, 2018 12:27 — forked from nasrulhazim/01.md
Laravel Default API Login

Setup

Migration

Create new migration script:

php artisan make:migration add_api_token --table=users
@savepong
savepong / gist:9f2696549e25135906e5caa21773e3b0
Created March 8, 2018 15:02
Laravel 5.6 SendGrid Integate
# installed with composer
composer require s-ichikawa/laravel-sendgrid-driver
# Add the sendgrid service provider in config/app.php:
'providers' => [
Sichikawa\LaravelSendgridDriver\SendgridTransportServiceProvider::class
];
# Config on .env
MAIL_DRIVER=sendgrid