function Get-Something( ValidateSet("value 1", "value 2", "value etc")] $parameter) { Write-Host "hi" }Just figured that out. Much bigger post here.
Wednesday, October 4, 2017
Powershell, Adding Autocomplete to a Function
tldr: Add the ValidateSet attribute to a parameter. Like this: [ValidateSet("value 1", "value 2", "value etc")]$parameter
or more verbosely:
Tuesday, September 5, 2017
A tale of Mardown and browser based code editors.
I like Markdown. I want to use Markdown as much as possible. I also enjoy embedding LaTeX and graphs. I like using a chromebook.
First, I used visual studio and Mads’ Markdown editor extension for it. I usually had a copy or three of visual studio open so that didn’t matter much. But I started extending Markdown with my own javascript functions. I also started trying to embedd LaTeX.
An example of LaTeX:
Which renders as:
I got many things set up on the Linux-chromebook, and I learned many cool things. I pulled the markdown-plus code from GitHub and served it up to localhost. I learned how to start a web server from the command line. I learned how to use yarn, and npm. I started learning modern javascript functions and extensions, like ‘require’ and ‘let’, among others. I then forked the code and began dissecting it to see if I could add the “Save” functionality that would make it a viable tool on my chromebook. I ran into CodeMirror. I was awed by CodeMirror. I added “Save” capability, that seemed to be missing from markdown-plus. Perhaps the author didn’t want it competing with his 15$ windows app? Perhaps I was just missing something. Anyway, I created a pull request and called that piece done-ish. I now had a good flavor of Markdown running on my awesome chromebook. I was feeling pretty good about that.
However, then I ran into StackEdit. It is also open source on GitHub. It is also dissectable. From it I’ve been learning about even more javascript stacks. For its editor it uses prismjs. I also see Gulp, Bower, and some others that I’m not yet familiar with.
Anyway, so much awesome here, so little time. I’ll probably be abandoning markdown-plus in favor of StackEdit. Ahhh, there’s an easter egg here when you type ‘StackEdit’.
First, I used visual studio and Mads’ Markdown editor extension for it. I usually had a copy or three of visual studio open so that didn’t matter much. But I started extending Markdown with my own javascript functions. I also started trying to embedd LaTeX.
An example of LaTeX:
\Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt\,.
Which renders as:
Then I found Markdown-plus which, is pretty awesome. I bought a copy. It works great in windows. I started writing LaTeX and graphs fluently. So I had to figure out a way to make it work on my chromebook. I started running Linux on it. Linux on a chromebook deserves a post or more in its own right. It is a very cool thing.
I got many things set up on the Linux-chromebook, and I learned many cool things. I pulled the markdown-plus code from GitHub and served it up to localhost. I learned how to start a web server from the command line. I learned how to use yarn, and npm. I started learning modern javascript functions and extensions, like ‘require’ and ‘let’, among others. I then forked the code and began dissecting it to see if I could add the “Save” functionality that would make it a viable tool on my chromebook. I ran into CodeMirror. I was awed by CodeMirror. I added “Save” capability, that seemed to be missing from markdown-plus. Perhaps the author didn’t want it competing with his 15$ windows app? Perhaps I was just missing something. Anyway, I created a pull request and called that piece done-ish. I now had a good flavor of Markdown running on my awesome chromebook. I was feeling pretty good about that.
However, then I ran into StackEdit. It is also open source on GitHub. It is also dissectable. From it I’ve been learning about even more javascript stacks. For its editor it uses prismjs. I also see Gulp, Bower, and some others that I’m not yet familiar with.
Anyway, so much awesome here, so little time. I’ll probably be abandoning markdown-plus in favor of StackEdit. Ahhh, there’s an easter egg here when you type ‘StackEdit’.
Written with StackEdit.
Sunday, September 3, 2017
Command Line web servers
The ability to serve up a random directory for http content is something that I learned quite recently.
The first way that I did it:
From the angular cli, there is also:
And one more:
There are others as well, some of them are listed here:
Link to stackexchange
no need to run some heavyweight tool like IIS, Visual Studio, Apache, etc.
Python3 -m http.server
From the angular cli, there is also:
ng-serve
And one more:
sudo npm install http-server -g
http-server
There are others as well, some of them are listed here:
Link to stackexchange
no need to run some heavyweight tool like IIS, Visual Studio, Apache, etc.
Monday, August 21, 2017
Fun with Angular and an HTML 5 canvas.
I updated my canvas-drawing post from 2014. Now it uses AngularJS instead of JQuery. Angular rocks.
Fiddle, GitHub
It doesn't embed well in blogger though.
The HTML: The javascript:
Fiddle, GitHub
It doesn't embed well in blogger though.
The HTML: The javascript:
Subscribe to:
Posts (Atom)