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'); |
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
'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 |
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
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache | |
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache | |
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache | |
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache |
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
Show hidden characters
{ | |
"presets": ["@babel/preset-env", "@babel/preset-react"], | |
"plugins": [ | |
[ | |
"@babel/plugin-proposal-class-properties", | |
{ | |
"loose": true | |
} | |
] | |
] |
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
/* | |
Conclusion | |
On identical strings localCompare function is pretty fast, but if there is any difference, bitwise search function named "equals" is faster | |
*/ | |
const CACHE = 'cache-and-update-v2.0.1'; | |
// bitwise | |
function equals(a, b) { |
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
import React from 'react'; | |
import pt from 'prop-types'; | |
import { Tooltip, OverlayTrigger } from 'react-bootstrap'; | |
/** | |
* A very expandable component for | |
* adding tooltip to elements easily. | |
* | |
* ``` | |
* <EasyTooltip |
OlderNewer