Skip to content

Instantly share code, notes, and snippets.

View ALTELMA's full-sized avatar

Phongthorn Khamkankaew ALTELMA

View GitHub Profile
@ALTELMA
ALTELMA / my-code.php
Created June 23, 2021 09:09
My Code :)
public function edit($id = NULL){
if(!empty($id)){
// LOAD SESSION DATA
$session_data = $this->session->userdata('userLogData');
// LOAD DATA FROM DATABASE
$assetObj = $this->assetModel->getAssetRow($id);
$categoryList = $this->assetModel->getDataList('category');
@ALTELMA
ALTELMA / img-html
Created September 19, 2019 18:09
Image-crop-center
a {
display: block;
width: 200px;
height: 200px;
overflow: hidden;
margin: 10px;
position: relative;
border: solid 1px #353535;
}
@ALTELMA
ALTELMA / postman-pre-request.js
Created January 22, 2019 05:10 — forked from bcnzer/postman-pre-request.js
Postman pre-request script to automatically get a bearer token from Auth0 and save it for reuse
const echoPostRequest = {
url: 'https://<my url>.auth0.com/oauth/token',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
client_id:'<your client ID>',
client_secret:'<your client secret>',
@ALTELMA
ALTELMA / anagram.php
Last active December 8, 2016 08:43
PHP Practice
<?php
function is_anagram($a, $b) {
return(count_chars($a, 1) == count_chars($b, 1));
}
?>
function getGAClient() {
$result = explode('.', $_COOKIE['_ga'], 3);
$count = count($result);
if ($count == 3) {
list($version, $depth, $clientId) = $result;
} else {
return false;
}
@ALTELMA
ALTELMA / datatable-upper-and-lower-case.js
Last active August 29, 2015 14:26
About different datatable declaration between uppercase and lowercase.
// Uppercase
$('example').Datatable();
// Lowercase
$('example').datatable();
<table id="employee-grid" cellpadding="0" cellspacing="0" border="0" class="display" width="100%">
<thead>
<tr>
<th>Employee name</th>
<th>Salary</th>
<th>Age</th>
</tr>
</thead>
</table>
cd /path/to/repo.git
chgrp -R groupname .
chmod -R g+rwX .
find . -type d -exec chmod g+s '{}' +
@ALTELMA
ALTELMA / XMLFeed.php
Last active August 29, 2015 14:25
PHP generate XML with large database.
class XMLFeed
{
private $xmlHeader = '<products>';
private $xmlFooter = '</products>';
private $xmlFeedFile = 'products.xml';
public function feed()
{
$offeset = 0;
$perLoop = 1000;