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
<?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
- 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 | |
// 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
function isNumberKey(evt) | |
{ | |
var charCode = (evt.which) ? evt.which : event.keyCode | |
if (charCode > 31 && (charCode < 48 || charCode > 57)) | |
return false; | |
return true; | |
} | |
<input type="text" onkeypress="return isNumberKey(event)" maxlength="5" placeholder="Search by Zip" id="addressInput"> |
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
var normal = document.querySelector('.normal'), | |
prevent = document.querySelector('.prevent'); | |
prevent.addEventListener('click', function(ev) { | |
alert('fabulous, really!'); | |
ev.preventDefault(); | |
}, false); | |
normal.addEventListener('click', function(ev) { | |
alert('fabulous, really!'); |
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
CREATE VIEW `table_view` | |
AS | |
select | |
* | |
from | |
table | |
where | |
id=... |
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
#Creating an archive using tar command | |
*c – create a new archive | |
*v – verbosely list files which are processed. | |
*f – following is the archive file name | |
*z – filter the archive through gzip | |
Note: .tgz is same as .tar.gz | |
//compress | |
tar cvf archive_name.tar dirname/ |
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 with permission 777 | |
find / -type f -perm 0777 | |
//find all without permission 777 | |
find / -type f ! -perm 0777 | |
//Wordpress chmod permission | |
define('FS_METHOD', 'direct'); |
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
var confirmDel = confirm("Are you sure? This is your last chance!"); | |
if(confirmDel === true) | |
{ | |
return true; | |
} else { | |
return false; | |
} |