A Pen by Babak Naghiyev on CodePen.
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
console.log("Before the first file is read."); | |
hypotheticalFileGetContents("sample.txt", function(fileContents){ | |
// fileContents now contains the file contents, this function is only called when the file read in the background has finished | |
console.log("After the first file has completed reading."); | |
}); | |
// You've now told it to start the first read, but it won't 'block' your script execution. It will do the read in the background, and immediately move on with the rest of your code. | |
console.log("Before the second file is read."); | |
hypotheticalFileGetContents("sample2.txt", function(fileContents){ |
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
'use strict'; | |
/* | |
# Javascript Prototyping Best Practices | |
* To create a class, create a constructor function with a `Name` and assign | |
it to a variable of the same `Name`. | |
* In this constructor only define properties using `this.prop` notation |
A Pen by Babak Naghiyev on CodePen.
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 | |
// Usage: <img src="placeholder-svg.php?wh=400x400&fill=bada55&color=000000&font=Georgia&size=20" /> | |
$wh = explode('x', $_GET['wh']); | |
$wh[0] = (int)$wh[0]; | |
$wh[1] = (int)$wh[1]; | |
$fill = isset($_GET['fill']) ? $_GET['fill']: '666666'; | |
$color = isset($_GET['color']) ? $_GET['color']: 'FFFFFF'; | |
$size = isset($_GET['size']) ? (int)$_GET['size']: 60; | |
$fontfamily = isset($_GET['font']) ? $_GET['font']: 'Arial'; | |
header('Content-Type: image/svg+xml'); |
NewerOlder