Skip to content

Instantly share code, notes, and snippets.

View tawanorg's full-sized avatar
🎯
Focusing

Tew Tawan tawanorg

🎯
Focusing
View GitHub Profile
@tawanorg
tawanorg / $wpdb Insert Multiple Records.php
Last active June 7, 2018 22:07
use $wpdb Insert Multiple Records Wordpress
// Setup arrays for Actual Values, and Placeholders
$values = array();
$place_holders = array();
// Then loop through the the values you're looking to add, and insert them in the appropriate arrays:
foreach($_POST as $key => $value)
{
array_push($values, $value, $order_id);
$place_holders[] = "('%d', '%d')" /* In my case, i know they will always be integers */
}
@tawanorg
tawanorg / Easy Customize Wordpress Pagination.php
Created February 26, 2015 04:51
Easy Customize Wordpress Pagination
<?php
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
$limit = 1;
$offset = ( $pagenum - 1 ) * $limit;
$results = $wpdb->get_results("SELECT * FROM ex_contactus LIMIT $offset, $limit");
// DISPLAY DATA
$total = $wpdb->get_var("SELECT COUNT('id') FROM ex_contactus ");
@tawanorg
tawanorg / app.js
Created February 1, 2016 17:34 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@tawanorg
tawanorg / JavaScript OOP | TimApp.filterData
Last active August 3, 2016 16:47
To filter data by color and capacity
/**
* @package timApp
* @subpackage filterData
* @desc To filter data by color and capacity
* @author tim tawan <tim-tawan@hotmail.com>
**/
var timApp = timApp || {};
timApp.filterData = {
@tawanorg
tawanorg / sublime_user_setting.txt
Last active August 19, 2016 04:39
Sublime User Setting
{
"always_prompt_for_file_reload": false,
"always_show_minimap_viewport": false,
"animation_enabled": true,
"atomic_save": false,
"auto_close_tags": true,
"auto_complete": true,
"auto_complete_commit_on_tab": false,
"auto_complete_cycle": false,
"auto_complete_delay": 50,
@tawanorg
tawanorg / esnextbin.md
Created September 6, 2016 03:22
esnextbin sketch
@tawanorg
tawanorg / esnextbin.md
Last active January 4, 2017 00:54
esnextbin sketch
@tawanorg
tawanorg / Debug-Knockout-JS.html
Created October 26, 2016 01:24 — forked from maxcnunes/Debug-Knockout-JS.html
Simple way to debug viewmodel data bind with knockout
<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>
@tawanorg
tawanorg / geolocation.js
Created June 14, 2017 12:01 — forked from allpwrfulroot/geolocation.js
Funky error, async issue or geolocation bug? watchPositionAsync callback EXPLODES (counter goes to hundreds) if getCurrentPosition called?
import React, { Component } from 'react'
import {
ActivityIndicator,
View,
Text,
Alert
} from 'react-native'
import { Permissions, Location, Notifications, Constants } from 'expo'
import { graphql, gql, compose } from 'react-apollo'
import update from 'immutability-helper'
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);