Thursday, February 28, 2019

Change themes at Angular Materials?

This suggests there are four default themes:

  1. deeppurple-amber.css
  2. indigo-pink.css
  3. pink-bluegrey.css
  4. purple-green.css

 
 

Include in a CSS file like so:

@import '@angular/material/prebuilt-themes/deeppurple-amber.css';

random just-getting-started notes on mixing Azure DevOps Pipelines with Octopus deployments

  • 1.$(Rev:r).0 is an example of a version number in Azure DevOps incrementing the minor version.
  • The package application command for an Angular app turns a dist folder into a .nupkg file (NuGet package). This is a part of a build pipeline as opposed to a release pipeline. The .nupkg is one of the Artifacts in Azure DevOps. A release pipeline in distinction takes an artifact and puts it in an environment, copying files onto a server somewhere, etc.
  • At a pipeline in Azure DevOps you may click the three dots in a horizontal progression at the upper right and pick "Export" to make a .json file out of all of the rules that make up that pipeline. There is an "Import a pipeline" beneath the "New" menu at Builds under Pipelines too that may be used to import such a file to be used as a starter for a new pipeline! YAML (Yet Another Markup Language) is apparently used to store the pipelines internally within Azure DevOps, but the YAML gets cast to JSON when exported from the interface.
  • Just as you need an application pool to run a website in IIS, you need an agent pool to run an Azure pipeline. The agent pool denotes the server to do the work of running tests, packaging, etc.
  • A build will have a series of tasks for doing things like running tests and linting. When you add a task you may search for "npm" to find a task type to run npm commands. This will have a drop down containing "install" which runs npm install and "custom" which runs npm run FILLINTHEBLANKHERE alternatively. You will use "custom" and type in "test" to run the unit tests. All of the tasks have a "Control Options" accordion to expand and the "Continue on error" checkbox, which is not checked by default, can allow the build to keep running even if a test fails though I do not recommend such an approach to continuous integration.
  • Under "Builds" under "Pipelines" in Azure DevOps at the upper right, there are two icons. One that looks like a bunch of checkmarks by a bunch of line items for "Recent" and one that looks like a manila folder for "Folders" in contrast. Click the folder icon if you do not see your build. It may have ended up tucked away here if it is not deemed to be recent.

How do I turn Pascal Case into Title Case in TypeScript?

I think there is a way to do that with lodash, as this suggests...

_.startCase('helloThere');

 
 

If you want roll something yourself you can do something like this however my invention can't really account for characters that are not letters. If you want to account for characters that are not letters you would have to check to see if .toUpperCase() and .toLowerCase() off of a character matched up I suppose. My stuff also does not play nice with one letter words like I or A. Anyhow, this will turn this:

export enum Role {
   Administrator,
   ComplianceGroup,
   BusinessUnitSME,
   BUAggregator,
   ReadOnlyAuditor
}

 
 

...into this:

  1. Administrator
  2. Compliance Group
  3. Business Unit SME
  4. BU Aggregator
  5. Read Only Auditor

I'm maybe going to do Jest testing.

Jest tests are basically like Jasmine/Karma tests except that the "it" leading a test is "test" instead of "it" unless you explicitly use "it" which will work too. There is also the concept of snapshot testing. If a snapshot of a component does not exist you may make one which is some sort of blob of data. Going forward, you may compare the blob created in a test to an existing blob to see if the component (including the template) changed (unexpectedly). There is a command (using the U keyboard key) to update snapshots if you are expecting change instead of being wary of it. This snapshot comparison stuff isn't particularly "code first" but that doesn't mean it is bad either.

Wednesday, February 27, 2019

SAP PowerDesigner

It's SAP's version of Balsamiq Mockups as best as I can tell at a glance.

Turn the text value of a TypeScript enum back into something with some spaces in it.

The backflips below account for acronyms.

private GetFriendlyRoleName():string {
   let betterName:string = "";
   if (this.user) {
      let spacelessName:string = Role[this.user.Role];
      let counter = 0;
      while (counter < spacelessName.length){
         if(counter > 0){
            if (spacelessName.charAt(counter) ==
                  spacelessName.charAt(counter).toUpperCase()){
               if (spacelessName.charAt(counter-1) == spacelessName.charAt(counter-
                     1).toUpperCase()){
                  if (counter + 1 < spacelessName.length) {
                     if (spacelessName.charAt(counter+1) ==
                           spacelessName.charAt(counter+1).toUpperCase()){
                        betterName = betterName + spacelessName.charAt(counter);
                     } else {
                        betterName = betterName + " " + spacelessName.charAt(counter);
                     }
                  } else {
                     betterName = betterName + spacelessName.charAt(counter);
                  }
               } else {
                  betterName = betterName + " " + spacelessName.charAt(counter);
               }
            } else {
               betterName = betterName + spacelessName.charAt(counter);
            }
         } else {
            betterName = betterName + spacelessName.charAt(counter);
         }
         counter++;
      }
   }
   return betterName;
}

package-lock.json is npm's version of yarn.lock

We may not really need Yarn anymore. The way it worked its magic was when you ran npm install for the first time and the dependencies in package.json got hydrated to the node_modules folder, a yarn.lock file would get created denoting what specific version, down to the patch, was pulled and what specific server it came from. Of course, both of these things are kind of wishy-washy and, in being subject to change, both of these things can break your app when you get different stuff in a second pass at npm install. If the yarn.lock files exists however, it will be used as guideline to prevent different versions and different servers from being used. In modern times you can do all this without Yarn by getting npm to make a package-lock.json file that does the same trick.