Skip to content

Instantly share code, notes, and snippets.

View ratiw's full-sized avatar

Rati Wannapanop ratiw

  • Nonthaburi, Thailand
View GitHub Profile
@ratiw
ratiw / gist:2d9b0b625c25e0db348713323a11f90d
Created April 14, 2024 14:15
HeidiSQL Connecting via SSH Tunnel
https://www.heidisql.com/forum.php?t=24073
@ratiw
ratiw / install-laravel-project.sh
Created October 10, 2020 03:20 — forked from cse031sust02/install-laravel-project.sh
Bash Script to install Laravel project from Git on LEMP stack
#!/bin/sh
########################################################
# Bash script to install HeavyGari Laravel App
# Written by Talha Ibne Imam
########################################################
HC='\033[0;32m' # Heading Color
WC='\033[0;33m' # Warning Color
NC='\033[0m' # No Color
@ratiw
ratiw / VuetableCssBootstrap4FontAwesome.js
Last active November 14, 2018 08:15
Vuetable CSS for Bootstrap4
export default {
table: {
tableWrapper: '',
tableHeaderClass: 'mb-0',
tableBodyClass: 'mb-0',
tableClass: 'table table-bordered table-hover',
loadingClass: 'loading',
ascendingIcon: 'fa fa-chevron-up',
descendingIcon: 'fa fa-chevron-down',
ascendingClass: 'sorted-asc',
@ratiw
ratiw / MyVuetable.vue
Created March 14, 2017 07:02
MyVuetable -- using `__slot`
<template>
<div class="ui container">
<div class="vuetable-pagination ui basic segment grid">
<vuetable-pagination-info ref="paginationInfoTop"
></vuetable-pagination-info>
<vuetable-pagination ref="paginationTop"
@vuetable-pagination:change-page="onChangePage"
></vuetable-pagination>
</div>
<vuetable ref="vuetable"
@ratiw
ratiw / Using Bower with Laravel 5.2 and Laravel Elixir.md
Last active February 10, 2018 16:53
Using Bower with Laravel 5.2 and Laravel Elixir
  • Install bower by following instruction at bower.io
  • Make bower knows where should it keeps downloaded/installed packages
    • Create .bowerrc at the root of project directory with the following content:
    {
      "directory": "vendor/bower_components"
    }

This will tell bower to use vendor/bower_components as its default directory

  • Put .bowerrc in .gitignore file
@ratiw
ratiw / Use static function to call internal function.md
Last active April 13, 2016 15:32
Use static function to call internal function

Instead of doing this

  $p = new PurchasePodcast;
  $p->handle();

This feels better

  PurchasePodcast::perform();
@ratiw
ratiw / Set DB_CONNECTION to use sqlite in-memory database when testing.md
Last active January 1, 2020 05:24
Set DB_CONNECTION to use sqlite in-memory database when testing

#Set DB_CONNECTION to use sqlite in-memory database when testing

  • Open `phpunit.xml' file in the current project
  • Add the following environment variables to the appropriate section
  <env name="DB_CONNECTION" value="sqlite">
  <env name="DB_DATABASE" value=":memory:">
  • in config\database.php file, change the default sqlite connection to
  'connections' => [
@ratiw
ratiw / extract_vars.js
Last active January 22, 2020 17:56
JS function to extract variables from template string
function extract_vars(template, openChar, closeChar) {
openChar = openChar || '{';
closeChar = closeChar || '}';
var i = 0;
var data = [];
do {
if (template[i] == '{') {
for (var j=i+1; j<template.length; j++) {

Steps

  1. Setup Laravel app
  2. Setup vue.js inside laravel app

Setup Laravel app

  • New Laravel app
  • Rename .env.example to .env
  • Config config/database.php to MySQL or SQLite
  • For SQLite, run touch storage/database.sqlite to create sqlite database
@ratiw
ratiw / Using Laravel Elixir on Windows 7_8_8.1.md
Created April 11, 2015 08:10
Using Laravel Elixir on Windows 7/8/8.1

Setup

  • Windows 7/8/8.1
  • Git (git-scm with Git Bash)
  • Fresh install of Laravel 5.0

** Do not install Elixir from within Homestead. It will not work! **

Steps

  • Run Git Bash
  • cd to the project directory