Restructures demos.

This commit is contained in:
Henning Dieterichs
2020-03-18 11:18:48 +01:00
parent af52efdc51
commit 57146f79a0
45 changed files with 128 additions and 6 deletions

17
demos/php/.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,17 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": "PHP - Demo",
"type": "php",
"request": "launch",
"program": "${workspaceFolder}/php/demo.php",
"xdebugSettings": {
"max_data": -1
}
}
]
}

8
demos/php/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,8 @@
{
"debugVisualizer.debugAdapterConfigurations": {
"php": {
"context": "watch",
"expressionTemplate": "${expr}"
}
}
}

32
demos/php/.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,32 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"label": "typescript-watch",
"script": "dev",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"path": "js/",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "csharp-build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/csharp/demo.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

33
demos/php/demo.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
// Install php, xdebug and the php debug extension for VS Code
// (https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug).
// The Debug Visualizer has no support for PHP data extractors yet,
// so to visualize data, your value must be a valid JSON string representing the data.
// See readme for supported data schemas.
$graph = [
"kind" => ["graph" => true],
"nodes" => [
["id" => "1", "label" => "1"]
],
"edges" => []
];
// Visualize "$visualize()"
$visualize = function () use (&$graph) {
return json_encode($graph);
};
for ($i = 2; $i < 100; $i++) {
// add a node
$id = "" . $i;
array_push($graph["nodes"],
["id" => $id, "label" => $id]);
// connects the node to a random edge
$targetId = "" . random_int(1, $i - 1);
array_push($graph["edges"],
["from" => $id, "to" => "" . $targetId]);
}
echo "finished";