- Split a string : http://us2.php.net/explode
- List the files in a directory : http://us1.php.net/glob
- Join arrays together http://us2.php.net/array_merge
- Randomly shuffle an array's elements http://us3.php.net/shuffle
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
Had to install ubuntu on a usb drive when my hard drive crashed. | |
Seems like in ubuntu 13.10, the usb-creator-gtk is corrupted. I followed a few instructions at | |
https://help.ubuntu.com/community/Installation/FromUSBStick and finally managed to install ubuntu on a usb drive. | |
This is waht had to be done before running startup disk creator | |
sudo add-apt-repository ppa:jmarsden/lubuntu | |
sudo apt-get update | |
sudo apt-get install usb-creator-gtk |
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
ini_set('display_errors', 'On'); | |
error_reporting(E_ALL); |
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
/* | |
Apparently using bodyParser is bad | |
http://andrewkelley.me/post/do-not-use-bodyparser-with-express-js.html | |
This is how you'd fetch post parameters using multiparty instead. | |
*/ | |
var multiparty = require('multiparty'); | |
//Fetching the value of a field in a post parameter | |
app.post('/yoururl', function(req, res) { |
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
$timeInterval = 10; | |
$timeFactor = 'seconds'; //Can be either 'days', 'hours', 'minutes' or 'seconds' | |
$now = date("Y-m-d H:i:s"); | |
$futureDate = date('Y-m-d H:i:s', strtotime($now. ' + '. $timeInterval .' '.$timeFactor)); |
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
$now = date("Y-m-d H:i:s"); | |
//Insert | |
$query = 'insert into '.$tableNamespace.'tableName(field1, field2, field3, field4) values ('. | |
'"'.$strValue1.'",'. | |
'"'.$strValue2.'",'. | |
$intValue3.','. | |
'"'.$now.'"'. | |
')'; |
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
$query="select * from your_table where"; | |
$resultSet = mysqli_query($con,$query); | |
$size = mysqli_num_rows($resultSet); | |
if($size>0){ | |
while($resultRow = mysqli_fetch_array($resultSet)){ | |
$fieldValue = $resultRow['field_name']; | |
} | |
} |
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
$( | |
//Setting the value of a radio button programmatically | |
$('input[type=radio]').prop('checked', true); | |
); |
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
foreach ($aMapLikeCollection as $key => $value) { | |
} |
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 randomize(arr) { | |
for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x); | |
return arr; | |
}; |