This file contains 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
// sort scores in order | |
scores.sort( function(obj1, obj2) { | |
return obj1.attempts - obj2.attempts; | |
}); |
This file contains 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
/** | |
* Gets real MIME type and then see if its on allowed list | |
* | |
* @param string $tmp : path to file | |
*/ | |
function check_file_is_audio( $tmp ) | |
{ | |
$allowed = array( | |
'audio/mpeg', 'audio/x-mpeg', 'audio/mpeg3', 'audio/x-mpeg-3', 'audio/aiff', | |
'audio/mid', 'audio/x-aiff', 'audio/x-mpequrl','audio/midi', 'audio/x-mid', |
This file contains 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 | |
/** | |
* Converts CSV to multi dimensional array | |
*/ | |
function csv_to_multidimension_array($filename='', $delimiter=',') | |
{ | |
if(!file_exists($filename) || !is_readable($filename)) { | |
return false; | |
} |
This file contains 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 | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: http://www.example.co.uk"); | |
?> |
This file contains 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
@ECHO OFF | |
doskey ls=dir | |
doskey clear=cls | |
doskey 7z="C:\Program Files\7-Zip\7z.exe" |
This file contains 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
/* MIXINs */ | |
@mixin transition( $val : ease 0.5s ) { | |
-webkit-transition: $val; | |
-moz-transition:$val; | |
-o-transition:$val; | |
-ms-transition:$val; | |
transition:$val; | |
} | |
@mixin text-shadow( $top: 3px, $left: 3px, $blur: 3px , $colour: #333 ) { |
This file contains 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
// hints | |
/* | |
# Ctrl + / # | comment line | |
# Ctrl + alt + x # | prefix css | |
# Ctrl + Shift + K # | Delete line | |
# Ctrl + Shift + a # | select text in <HTML> tag <p>[here]</p> | |
# Ctrl + ALT + M # | MINIFY SELECTED TEXT | |
*/ |
This file contains 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME}.php -f | |
RewriteRule ^(.*)$ $1.php | |
</IfModule> |
This file contains 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
# inline | |
mail -s "Subject of Message" [email protected] < /dev/null | |
# variables as parameters | |
$MSG="This is the body of the email address" | |
$SUBJET="Test Email Subject" | |
$ADDRESS="[email protected]" | |
echo $MSG | mail -s $SUBJECT $ADDRESS |
This file contains 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
/** | |
* Round up to the nearest multiple of your choice. | |
* | |
* @param int $number | |
* @param int $near | |
* @return int | |
*/ | |
function get_nearest_multiple( $number, $near ) | |
{ | |
$nearest = round($number/$near)*$near; |
NewerOlder