Skip to content

Instantly share code, notes, and snippets.

View tranchausky's full-sized avatar
🏹
done

chautran tranchausky

🏹
done
View GitHub Profile
@tranchausky
tranchausky / unserialize.php
Created August 1, 2020 08:40
fix unserialize in php, fix PHP: error: Notice: unserialize(): Error at offset 438 of 750 bytes in
<?php
$str = preg_replace_callback(
'!s:(\d+):"(.*?)";!',
function($m) {
return 's:'.strlen($m[2]).':"'.$m[2].'";';
},
$str);
<script>
function sortObj(list, key) {
function compare(a, b) {
a = a[key];
b = b[key];
var type = (typeof(a) === 'string' ||
typeof(b) === 'string') ? 'string' : 'number';
var result;
if (type === 'string') result = a.localeCompare(b);
@tranchausky
tranchausky / javascript object sort desc.js
Created January 13, 2021 08:26
Sort firebase data in descending
function sortDescObj(list, key) {
var sortedKeys = Object.keys(list).sort(function(a,b) {
return list[a][key] > list[b][key] ? -1:1
});
var newObjectSort = []
var tem=[]
for (let index = 0; index < sortedKeys.length; index++) {
tem=[]
newObjectSort.push(list[sortedKeys[index]])
}
@tranchausky
tranchausky / DataTables.php
Created October 15, 2021 04:32
DataTables Class for codeigniter 2,3
<?php
//update from https://datatables.net/forums/discussion/44562/datatables-1-10-with-codeigniter-3-1-5
class DataTables
{
protected $CI;
private $database;
@tranchausky
tranchausky / minify.sh
Last active July 28, 2022 06:09
get list file css,js and check content from minify.sh
#need install package https://aur.archlinux.org/packages/yuicompressor
#yum install yuicompressor
#!/bin/bash
#Minify CSS
input='script/css/bbk_interactive/index.css';
output='script/css/bbk_interactive/index.min.css';
yuicompressor $input > $output
echo 'Minified' $input '-->' $output;
@tranchausky
tranchausky / .htaccess
Created October 4, 2022 01:52
view 404 image from link with certificate
RewriteEngine On
ErrorDocument 404 /images/mywebsite/404.php
/*
*
* TextExport 1.3 - by Bramus! - http://www.bram.us/
* text layer style export added by Max Glenister (@omgmog) http://www.omgmog.net
*
* v 1.x - ????.??.?? - UPD: HTML Output (?)
* v 1.3 - 2008.03.16 - UPD: Base rewrite, now gets all layers (sets & regular ones) in one variable.
* - ADD: Layer Path & Layer Name in export
* - ADD: Cycle Multiple Files
* v 1.2 - 2008.03.11 - User friendly version Added filesave dialog (*FIRST RELEASE*)
@tranchausky
tranchausky / get_param.php
Created October 10, 2022 02:47
php get parameter when run in bash
<?php
//php .\get_param.php 123
if (php_sapi_name() === "cli") {
var_dump($argv[1]);
}else{
exit('Not allow');
}
@tranchausky
tranchausky / bootstrap.html
Created October 10, 2022 09:18
bootstrap show column first in mobile (order change)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
@tranchausky
tranchausky / laravel webpack.js
Created October 11, 2022 09:50
laravel mix file css,js two run type command
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
| https://laravel-mix.com/docs/6.0/what-is-mix
|--------------------------------------------------------------------------
| npm install laravel-mix@latest --save-dev
| npm run dev
| npm run production