This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert number to text | |
* | |
* @param number | |
* @param prefix | |
*/ | |
function numberToText(number, prefix = '') { | |
// số, tên thường, tên hàng chục > 20, tên hàng chục > 10, =< 20 | |
let range1 = [ | |
[0, 'không', '', ''], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'app/Mage.php'; | |
Mage::app(); | |
$allCategories = Mage::getModel ( 'catalog/category' ); | |
$categoryTree = $allCategories->getTreeModel(); | |
$categoryTree->load(); | |
$categoryIds = $categoryTree->getCollection()->getAllIds (); | |
if ($categoryIds) { | |
$outputFile = "var/export/categories.csv"; | |
$write = fopen($outputFile, 'w'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This code is public domain, share and enjoy. --> | |
<html> | |
<style type="text/css" media="screen"> | |
#table { | |
position: absolute; | |
top: 30px; | |
bottom: 0; | |
left: 10px; | |
right: 10px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!empty($_POST['image'])) { | |
$base64_img = str_replace('data:image/png;base64,', '', $_POST['image']); | |
base64_to_jpeg($base64_img, './files/hinh_'. uniqid() .'.jpg'); | |
} | |
function base64_to_jpeg($base64_string, $output_file) { | |
$ifp = fopen($output_file, "wb"); | |
$data = explode(',', $base64_string); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Compress MySQL tables on disk. | |
# Author: Andrew Berry, [email protected] | |
# | |
# Compress all tables in a MySQL InnoDB database using compression from the | |
# Barracuda table format. Tables have to already be in the Barracuda file | |
# format to actually compress tables, otherwise the table setting is ignored. | |
# | |
# innodb_file_per_table = 1 MUST be set in my.cnf for compression to work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env perl | |
################################################### | |
# | |
# Copyright (C) 2016 Long Nguyen <[email protected]> | |
# | |
# This file is part of Shutter. | |
# | |
# Shutter is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 3 of the License, or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VM=$1 | |
if [[ -z "$1" ]]; then | |
echo "Please provide your VM name." | |
echo " ./fix.sh \"OS X El Capitan Final\"" | |
echo "To list your VM" | |
echo " VBoxManage list vms" | |
exit 1; | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find all PHP files and save to phan_files.txt | |
find ./ -type f -name "*.module" \ | |
-o -name "*.php" \ | |
-o -name "*.inc" \ | |
-o -name "*.engine" \ | |
-o -name "*.install" \ | |
-o -name "*.test" \ | |
-o -name "*.theme" \ | |
> phan_files.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// link: https://www.atwix.com/magento/magento-and-php-7/ | |
// file: app/code/core/Mage/Core/Model/Layout.php | |
// line: 555 | |
$out .= $this->getBlock($callback[0])->$callback[1](); | |
// should be | |
$out .= $this->getBlock($callback[0])->{$callback[1]}(); |