To create an anchor to a heading in github flavored markdown.
Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading)
so your link should look like so:
[create an anchor](#anchors-in-markdown)
var p1 = { | |
x: 20, | |
y: 20 | |
}; | |
var p2 = { | |
x: 40, | |
y: 40 | |
}; |
// limits value to the range min..max | |
function clamp(val, min, max) { | |
return Math.max(min, Math.min(max, val)) | |
} | |
// Find the closest point to the circle within the rectangle | |
// Assumes axis alignment! ie rect must not be rotated | |
var closestX = clamp(circle.X, rectangle.x, rectangle.x + rectangle.width); | |
var closestY = clamp(circle.Y, rectangle.y, rectangle.y + rectangle.height); |
HTML5 canvas Performance and Optimization Tips, Tricks and Coding Best Practices With canvas being still very new to internet, and no signs of it ever getting old that I can see in the future, there are not too many documented best practices or other really important tips that are a must know for developing with it in any one particular place. Things like this are scattered around and many times on lesser known sites.
There's so many things that people need to know about, and still so much to learn about, so I wanted to share some things to help people who are learning canvas and maybe some who already know it quite well and am hoping to get some feedback from others about what they feel are some best practices or other tips and tricks for working with canvas in HTML5.
I want to start off with one I personally found to be quite a useful yet surprisingly uncommon thing for developers to do. Indent your code Just as you would any other time, in any other language whatever the case may be. It has been a best p
IE9, IE10, and IE11 don't properly scale SVG files added with img
tags when viewBox
, width
and height
attributes are specified. View this codepen on the different browsers.
Image heights will not scale when the images are inside containers narrower than image widths. This can be resolved in 2 ways.
As per this answer on Stackoverflow, the issue can be resolved by removing just the width
and height
attributes.
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ nano ~/.zshrc
path=('/path/to/depot_tools' $path)
-Dproperty=value Pass -Dproperty=value directly to the runtime system. | |
-J<flag> Pass <flag> directly to the runtime system. | |
-P:<plugin>:<opt> Pass an option to a plugin | |
-X Print a synopsis of advanced options. | |
-bootclasspath <path> Override location of bootstrap class files. | |
-classpath <path> Specify where to find user class files. | |
-d <directory|jar> destination for generated classfiles. | |
-dependencyfile <file> Set dependency tracking file. | |
-deprecation Emit warning and location for usages of deprecated APIs. | |
-encoding <encoding> Specify character encoding used by source files. |
// Both, function declaration and function body are hoisted to top of scope. | |
// Outside of scope, hence ReferenceError | |
console.log(foo); // ReferenceError: foo is not defined | |
(function () { | |
// Declaration and function body got hoisted to top of scope | |
console.log(foo); // [Function: foo] | |
console.log(foo()); // 'bar' |