context.strokeStyle=color
Sets the color that will be used to stroke the outline of the current path.
These are color options (these must be quoted):
A CSS named color, for example context.strokeStyle='red'
A hex color, for example context.strokeStyle='#FF0000'
An RGB color, for e...
context.fillStyle=color
Sets the color that will be used to fill the interior of the current path.
These are color options (these must be quoted):
A CSS named color, for example context.fillStyle='red'
A hex color, for example context.fillStyle='#FF0000'
An RGB color, for example ...
context.lineWidth=lineWidth
Sets the width of the line that will stroke the outline of the path
<!doctype html>
<html>
<head>
<style>
body{ background-color:white; }
#canvas{border:1px solid red; }
</style>
<script>
window.onload=(function(){...
shadowColor = color // CSS color
shadowBlur = width // integer blur width
shadowOffsetX = distance // shadow is moved horizontally by this offset
shadowOffsetY = distance // shadow is moved vertically by this offset
This set of attributes will add a shadow around a path.
Bo...
var gradient = createLinearGradient( startX, startY, endX, endY )
gradient.addColorStop(gradientPercentPosition, CssColor)
gradient.addColorStop(gradientPercentPosition, CssColor)
[optionally add more color stops to add to the variety of the gradient]
Creates a reusable linear gradient (object...
var gradient = createRadialGradient(
centerX1, centerY1, radius1, // this is the "display' circle
centerX2, centerY2, radius2 // this is the "light casting" circle
)
gradient.addColorStop(gradientPercentPosition, CssColor)
gradient.addColorStop(gradientPerce...
JavaScript supports several types of group in it's Regular Expressions, capture groups, non-capture groups and look-aheads. Currently, there is no look-behind support.
Capture
Sometimes the desired match relies on it's context. This means a simple RegExp will over-find the piece of the String that...
Once you have setup and configured the php5-fpm and wordpress settings you can configure the /etc/nginx/conf/nginx.conf file as below.
You need to define the location blocks inside the server block and rewrite the url there as defined.
server {
listen 443 ssl;
server_name abc.co.uk;
...
for /L %%A in (1,2,40) do echo %%A
This line will iterate from 1 to 39, increasing by 2 each time.
The first parameter, 1, is the starting number.
The second parameter, 2, is the increment.
The third parameter, 40, is the maximum.
Use itertools.chain to create a single generator which will yield the values from several generators in sequence.
from itertools import chain
a = (x for x in ['1', '2', '3', '4'])
b = (x for x in ['x', 'y', 'z'])
' '.join(chain(a, b))
Results in:
'1 2 3 4 x y z'
As an alternate constructo...
import std.stdio;
T min(T)(in T arg1, in T arg2) {
return arg1 < arg2 ? arg1 : arg2;
}
void main() {
//Automatic type inference
writeln(min(1, 2));
//Explicit type
writeln(min!(ubyte)(1, 2));
//With single type, the parenthesis might be ommited
...
You can check for syntax errors and referenced files in an NGINX configuration file before running it with:
nginx -t
Alternatively you can run service script
service nginx configtest
While both of these commands will tell you if your new nginx configuration is ok [without killing your curren...
Enabling gzip compression can reduce the size of the transferred response by up to 90%, which can significantly reduce the amount of time to download the resource, reduce data usage for the client, and improve the time to first render of your pages. — PageSpeed Insights
Compression can be ena...
Fetching resources over the network is both slow and expensive: the download may require multiple roundtrips between the client and server, which delays processing and may block rendering of page content, and also incurs data costs for the visitor. All server responses should specify a caching p...
Arithmetic operators in C++ have the same precedence as they do in mathematics:
Multiplication and division have left associativity(meaning that they will be evaluated from left to right) and they have higher precedence than addition and subtraction, which also have left associativity.
We can also...
These operators have the usual precedence in C++: AND before OR.
// You can drive with a foreign license for up to 60 days
bool can_drive = has_domestic_license || has_foreign_license && num_days <= 60;
This code is equivalent to the following:
// You can drive with a foreign licens...
template< class Iterator >
bool next_permutation( Iterator first, Iterator last );
template< class Iterator, class Compare >
bool next_permutation( Iterator first, Iterator last, Compare cmpFun );
Effects:
Sift the data sequence of the range [first, last) into the next lexicograph...
A condition variable is a primitive used in conjunction with a mutex to orchestrate communication between threads. While it is neither the exclusive or most efficient way to accomplish this, it can be among the simplest to those familiar with the pattern.
One waits on a std::condition_variable with...