Skip to content

Instantly share code, notes, and snippets.

View enqtran's full-sized avatar

enqtran enqtran

View GitHub Profile
1 - Border Radius
Ex:
.circle {
background: #456BD9;
border: 0.1875em solid #0F1C3F;
border-radius: 50%;
box-shadow: 0.375em 0.375em 0 0 rgba(15, 28, 63, 0.125);
height: 5em;
width: 5em;
}
1. Selecting elements
// jQuery, select all instances of .box
$(".box");
// Instead, select the first instance of .box
document.querySelector(".box");
// …or select all instances of .box
document.querySelectorAll(".box");
2. Running a function on all elements in a selection
0 Upload successful
1 File exceeds maximum upload size specified in php.ini (default 2 MB)
2 File exceeds size specified by MAX_FILE_SIZE (see PHP Solution 9-1)
3 File only partially uploaded
4 Form submitted with no file specified
6 No temporary folder
7 Cannot write file to disk
8 Upload stopped by an unspecified PHP extension
Inspecting a Folder with scandir()
Ex: $files = scandir('../images');
Inspecting the Contents of a Folder with FilesystemIterator
Ex: $files = new FilesystemIterator('../images');
getFilename() The name of the file
getPath() The current object’s relative path minus the filename, or minus the folder name if the current object is a folder
getPathName() The current object’s relative path, including the filename or folder name, de-pending on the current type
getRealPath() The current object’s full path, including filename if appropriate
The following are the most important functions used for this type of operation:
• fopen(): Opens a file
• fgets(): Reads the contents of a file, normally one line at a time
• fgetcsv(): Gets the current line from a CSV file and converts it into an array
• fread(): Reads a specified amount of a file
• fwrite(): Writes to a file
• feof(): Determines whether the end of the file has been reached
• rewind(): Moves the internal pointer back to the top of the file
• fseek(): Moves the internal pointer to a specific location in the file
• fclose(): Closes a file
Update 16.9.0 (August 8, 2019):
componentWillMount → constructor & componentDidMount
componentWillReceiveProps → getDerivedStateFromProps & componentDidUpdate
componentWillUpdate → componentDidUpdate
#1: Web Hosting
#2: CDN
#3: Caching
#4: Minification
#5: Combine Code
#6: Gzip Compression
#7: HTTP/2
#8: Server Tech
#9: WordPress Updates
#10: WordPress Theme
<!-- Let's load this in-viewport image normally -->
<img src="hero.jpg" alt="…">
<!-- Let's lazy-load the rest of these images -->
<img data-src="unicorn.jpg" alt="…" loading="lazy" class="lazyload">
<img data-src="cats.jpg" alt="…" loading="lazy" class="lazyload">
<img data-src="dogs.jpg" alt="…" loading="lazy" class="lazyload">
<script>
if ('loading' in HTMLImageElement.prototype) {
ln -s /data/files /var/www/html/edm/
service httpd restart
You can set expose_php = Off in your php.ini if you don't want it to send X-Powered-By header.