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 | |
// php-export-data by Eli Dickinson, http://github.com/elidickinson/php-export-data | |
require 'php-export-data.class.php'; | |
$exporter = new ExportDataExcel('browser', 'test.xls'); | |
$exporter->initialize(); | |
$exporter->addRow(array("This", "is", "a", "test")); | |
$exporter->addRow(array(1, 2, 3, "123-456-7890")); | |
$exporter->finalize(); | |
exit(); |
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
- add tmp column to have DATE format | |
ALTER TABLE requests | |
ADD tmp DATE; | |
/update Varchar format of mm/dd/yyyy | |
UPDATE requests | |
SET | |
tmp = STR_TO_DATE(date_due,'%m/%d/%Y'); | |
//drop date_due column |
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 | |
/** | |
* @Desc: Convert str1,str2,str3,str4,str5,....... to fix table columns | |
* @param string, delimiter, number of column | |
* @return Table markup fix columns | |
*/ | |
function pre_table($str, $del = ',', $numCols = '3'){ | |
$cnt = 0; | |
$arr = explode($del,$str); | |
$out_str = "<table width='100%'>"; |
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
// @Desc: Convert str1,str2,str3,str4,str5,....... to fix table columns | |
// @Param: String, delimiter, number_col | |
// @Return: Table markup - fixed columns | |
function prep_table(str,del,numCols){ | |
var cnt = 0; | |
var arr = str.split(del); | |
var loop = arr.length; | |
var out_str = "<table width='100%'>"; | |
for (cnt=0; cnt<loop; cnt++) | |
{ |
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
/** | |
* Hide ACF menu item from the admin menu | |
*/ | |
function hide_admin_menu() | |
{ | |
global $current_user; | |
get_currentuserinfo(); | |
if($current_user->user_login != 'admin') |
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 you would like to remove a tag along with the text inside it then use the following code. | |
<?php | |
preg_replace('/(<tag>.+?)+(<\/tag>)/i', '', $string); | |
?> | |
example | |
<?php $string='<span class="normalprice">55 PKR</span>'; ?> | |
<?php |
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 the link being clicked is external the user will be prompted | |
// to confirm they wish to leave the site. Confirmation results in | |
// the external link being opened in a new window | |
$('a') | |
.bind('click', function(event) { | |
var a = new RegExp('/' + window.location.host + '/'); | |
if(!a.test(this.href)) { |
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
// First way | |
$('#checkBox').attr('checked'); | |
// Second way | |
$('#edit-checkbox-id').is(':checked'); | |
//input name array | |
$('input[name=SOME_NAME\\[\\]]').is(':checked') |
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
sudo service httpd graceful | |
sudo /etc/init.d/apache2 restart | |
sudo /etc/init.d/apache2 stop | |
sudo /etc/init.d/apache2 reload |
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
useradd -m -d /home/USER_NAME -g wheel USER_NAME | |
usermod -G GROUP1,GROUP2 USER_NAME |