Chrome Self-Signed SSL HSTS
Ignoring unsecure-site blocking on Chrome with self-signed SSL and HSTS
When viewing a development site that is using a self-signed certificate, it's normally possible to ignore the security message by "continuing" onto the site.
However, sometimes (and I don't know why) sites will give the message but not the ability to continue.
It turns out that Chrome has an easter egg that allow you to quickly and easily ignore the message.
Simply type thisisunsafe
into the page (it will not appear on screen while typing) and hey-presto.
String Template Format
Which format to use for string templates in different languages
A relatively recent addition to programming languages are string templates, but I struggle to remember the correct format between C#, VB.Net and JavaScript...
C#var test = $"Hello {name}";
VB.NetDim test As String = $"Hello {name}"
JavaScriptlet test = `Hello ${name}`
Convert List<object> to List<int>
How to easily convert a list of objects to a list of primative types
If you have a generic List<object>
of class objects, and want to generate a list of primative type based on a single class property, use the following...
C#
var newList = myList.ConvertAll(x => x.myProp);
VB.Net
Dim newList As List(of Integer) = myList.ConvertAll(Function(x) x.myProp)
It is not necessary to cast the primative type.
Added 22/02/2023 12:10URI encoding in Javascript
Difference between encodeURI and encodeURIComponent
I can never remember the difference between encodeURI
and encodeURIComponent
when encoding data for inclusion on URI/URLs.
For general use, encodeURIComponent
is what I need, as it also encodes the following characters: ; / ? : @ & = + $ , #
Merging jQuery objects
How to merge jQuery objects for method chaining
When working with jQuery, you sometimes have two or more objects for specific functionality...
$one = $("#one");
$two = $("#two");
$three = $("#three");
But what if you want to call methods on all of them at the same time? Instead of..
$one.show().addClass("myClass");
$two.show().addClass("myClass");
$three.show().addClass("myClass");
You can .add() them together...
$one.add($two).add($three).show().addClass("myClass");
This has the advantage of being non-destructive, so it does not effect the first object (unlike $.merge
)