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 they DID upload a file... | |
if($_FILES['photo']['name']) | |
{ | |
//if no errors... | |
if(!$_FILES['photo']['error']) | |
{ | |
//now is the time to modify the future file name and validate the file | |
$new_file_name = strtolower($_FILES['photo']['tmp_name']); //rename file | |
if($_FILES['photo']['size'] > (1024000)) //can't be larger than 1 MB | |
{ |
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 ul = document.getElementById("list"); | |
ul.insertAdjacentHTML("beforeEnd", "<li>A new li on the list.</li>"); | |
ul.insertAdjacentHTML("beforeEnd", "<li>Another li!</li>"); | |
.insertAdjacentHTML("beforeBegin", ...) | |
.insertAdjacentHTML("afterBegin", ...) | |
.insertAdjacentHTML("beforeEnd", ...) | |
.insertAdjacentHTML("afterEnd", ...) |
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(exports){ | |
var class_list = !!document.body.classList; | |
var s = '(\\s|^)'; // space or start | |
var e = '(\\s|$)'; // space or end | |
function getRegex(className){ | |
return new RegExp(s + className + e, 'g'); | |
} | |
exports.addClass = function(element, className){ |
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
<form id='registration' name='registration' action='/register'> | |
<input type='text' name='username' value='carlos'> | |
<input type='email' name='email' value='[email protected]'> | |
<input type='number' name='dob' value='1940'> | |
<input type='submit' onclick='return sendForm(this.form);'> | |
</form> |
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 extend( a, b ) { | |
for( var key in b ) { | |
if( b.hasOwnProperty( key ) ) { | |
a[key] = b[key]; | |
} | |
}; | |
return a; | |
} |
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
/* You can aslo add */ | |
canvas { | |
image-rendering: optimizeSpeed; | |
image-rendering: -moz-crisp-edges; | |
image-rendering: -webkit-optimize-contrast; | |
image-rendering: optimize-contrast; | |
-ms-interpolation-mode: nearest-neighbor; | |
} |
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 getOffset( el ) { | |
var offsetTop = 0, offsetLeft = 0; | |
do { | |
if ( !isNaN( el.offsetTop ) ) { | |
offsetTop += el.offsetTop; | |
} | |
if ( !isNaN( el.offsetLeft ) ) { | |
offsetLeft += el.offsetLeft; | |
} | |
} while( el = el.offsetParent ) |
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
// Instead of this.. | |
if(callback) { | |
callback(); | |
} | |
// you can use this. | |
callback && callback(); |
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
Element.prototype.on = Element.prototype.addEventListener; |
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 $ = document.querySelectorAll.bind(document); |