Skip to content

Instantly share code, notes, and snippets.

@carlostxm
carlostxm / exhaustive-conditionals-example.ts
Created May 31, 2023 16:16
Typescript exhaustive conditionals
class A{
method(){
console.log('A');
}
}
class B {
method(){
console.log('B')
}
function randomArrayValues(length, minValue, maxValue) {
return new Array(length).fill(0).map(n => (Math.random() * (maxValue - minValue) + minValue));
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carlostxm
carlostxm / spain-provinces
Created February 18, 2018 09:46
GSON Spain provinces
This file has been truncated, but you can view the full file.
{
"type" : "Topology",
"objects" : {
"provinces" : {
"type" : "GeometryCollection",
"geometries" : [{
"type" : "Polygon",
"id" : "04",
"arcs" : [[2, 335, 276, 222, 44, 45, 310, 311, 324, 260, 284, 186, 182, 268, 269, 326, 327, 328, 330, 331, 235, 236, 292, 293, 294, 177, 332, 220, 274, 166, 278, 72, 196, 303, 338, 339, 13, 14, 10, 146, 42, 43, 36, 37, 116, 112, 113, 114, 288, 206, 207, 208]]
}, {
@carlostxm
carlostxm / typescriptreact.json
Created January 25, 2018 08:58
VS Code Snippet - Jest test describe and test use case
{
"describe_test": {
"prefix": "describe",
"body": [
"describe('${1:test description}', () => {",
"\tit('${2:unit test description}', () => {",
"\t\t// Arrange",
"\t\t// Act",
"\t\t// Assert",
"\t});",
@carlostxm
carlostxm / spain-municipalities.json
Created December 28, 2017 11:31
GeoJSON file containing polygons divided by municipalities, provinces and autonomous regions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.