Skip to content

Instantly share code, notes, and snippets.

@DBremen
DBremen / README.md
Last active August 22, 2018 09:16 — forked from bollwyvl/README.md
A fishbone editor
  • Make a bulleted Markdown list in the top left to update the list
  • Press edit to hide the editor
  • Press save to use [SVG Crowbar][crowbar] to save a copy
  • Click to drag nodes and drop

This is an integration of [this implementation][orig] of a [Fishbone or Ishikawa][ish] diagram, which shows contributions of different levels of a hierarchy to a main concept, with a Markdown editor for making quick diagrams.

The diagram is implemented in [d3.js][d3], while rich-text editing is provided by [CodeMirror][cm], and [marked][mkd] handles Markdown processing.

Function New-PSWebServer {
<#
.Synopsis
Creates a web server that will invoke PowerShell code based on routes being asked for by the client.
.Description
New-PSWebServer creates a web server. The web server is composed of a schema that defines the client's requests to routes where PowerShell code is executed.
Under the covers, New-PSWebServer uses the HTTPListener .NET class to execute powershell code as requested, retrieves the results and sends data back through the httplistener web server framework.
function Show-HTML ([string]$HTML){
Add-Type –AssemblyName PresentationFramework
if(Test-Path $HTML -IsValid){
$txt = Get-Content $HTML -Raw
$HTML = $txt
}
$HTML.Replace('<head>','<meta name="viewport" content="width=device-width, initial-scale=1"><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta http-equiv="Content-Type" content="text/html;charset=utf-8">')
[xml]$XAML = @'
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Function Show-Diff {
param([String[]]$OldString,[String[]]$NewString)
$WebPage = @"
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
function New-PowershellWebGUI ($HTMLRaw,$Title,$Runspace) {
[xml]$xaml = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="$Title" Height="500" Width="700">
<Grid>
<DockPanel>
<WebBrowser Name="WebBrowser" DockPanel.Dock="Top" Margin="30">
</WebBrowser>
function Get-RandomUser {
<#
.SYNOPSIS
Generate random user data.
.DESCRIPTION
This function uses the free API for generating random user data from https://randomuser.me/
.EXAMPLE
Get-RandomUser 10
.EXAMPLE
Get-RandomUser -Amount 25 -Nationality us,gb -Format csv -ExludeFields picture