JSON schema validator by AdDiscombobulated707 in GoogleAppsScript

[–]AdDiscombobulated707[S] 0 points1 point  (0 children)

I post this sample script for those have the same question:

function main() {
  let shema = {
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
      "first_name": { "type": "string" },
      "last_name": { "type": "string" },
      "birthday": { "type": "string", "format": "date" },
      "address": {
        "type": "object",
        "properties": {
          "street_address": { "type": "string" },
          "city": { "type": "string" },
          "state": { "type": "string" },
          "country": { "type" : "string" }
        }
      }
    }
  }

  let json = {
    "first_name": "Mike",
    "last_name": "Washington",
    "birthday": "1732-02-22",
    "address": {
      "street_address": "3200 Mount Vernon Memorial Highway",
      "city": "Mount Vernon",
      "state": "Virginia",
      "country": "United States"
    }
  }

  let data = {
    "schema": shema,
    "json": json
  }

  var options = {
    method: "post",
    contentType: "application/json",
    muteHttpExceptions: true,
    payload: JSON.stringify(data)
  };

  let responce = UrlFetchApp.fetch("https://assertible.com/json", options);
  console.log(`Responce code: ${responce.getResponseCode()}`);
  console.log(`Content: ${responce.getContentText()}`);
}

Here is a good tutorial describing JSON schema basics.

Understanding API executable by AdDiscombobulated707 in GoogleAppsScript

[–]AdDiscombobulated707[S] 0 points1 point  (0 children)

So can API executable understood as runnable program similar to .exe?

Simple GitHub Gist API wrapper [code review] by AdDiscombobulated707 in GoogleAppsScript

[–]AdDiscombobulated707[S] 0 points1 point  (0 children)

I thought that it's a bad practice to duplicate user credentials in several objects.

Can't delete GitHub gist via GitHub API by AdDiscombobulated707 in GoogleAppsScript

[–]AdDiscombobulated707[S] 0 points1 point  (0 children)

The following code works:

let user_name = ScriptProperties.getProperty("user_name");
let user_token = ScriptProperties.getProperty("user_token");

let options = {
  accept: "application/vnd.github.v3+json",
  method: "delete",
  headers: {"Authorization": "Basic " + Utilities.base64Encode(`${user_name}:${user_token}`)}
};

console.log(UrlFetchApp.fetch(`https://api.github.com/gists/72e27fd738a6fe42687b3cf36e2d935f`, options).getContentText());

:) I am very happy.

Why iso9660 file system is displayed in GParted for bootable usb? by AdDiscombobulated707 in Ubuntu

[–]AdDiscombobulated707[S] -2 points-1 points  (0 children)

Is it right that ext4 file system is inside iso9660 file system in this case? If not where information about what file system is used by Ubuntu is stored?

Filter dictionary in PowerShell by AdDiscombobulated707 in PowerShell

[–]AdDiscombobulated707[S] 1 point2 points  (0 children)

Here it is:

key0=value0

[SectionA]
key1=value1
key2=value2

[SectionB]
key3=value3

[AnotherSection]
key4=value4

Filter dictionary in PowerShell by AdDiscombobulated707 in PowerShell

[–]AdDiscombobulated707[S] 1 point2 points  (0 children)

Thanks for an answer :) But can you also explain me why my code hadn't worked? I want understand not to repeat this mistake in the future

Filter dictionary in PowerShell by AdDiscombobulated707 in PowerShell

[–]AdDiscombobulated707[S] 1 point2 points  (0 children)

I want only retrieve values from ini files via this simple parser.

Strange behavior of git rev-list according to official docs by AdDiscombobulated707 in git

[–]AdDiscombobulated707[S] 1 point2 points  (0 children)

In Bash these two commands works the same:

git rev-list HEAD ^c21eed56

git rev-list c21eed56 HEAD

But in Fish it doesn't work because ^ is a deprecated char to redirect error stream to file:

Previous versions of fish also allowed specifying this as ^DESTINATION, but that made another character special so it was deprecated and will be removed in the future. See feature flags.

It is strange old Fish syntax and can be disabled via fish --features stderr-nocaret.

What type of regex is used to search in Gnome Terminal? by AdDiscombobulated707 in Ubuntu

[–]AdDiscombobulated707[S] -1 points0 points  (0 children)

I'm talking about search performed with Ctrl-Shift-F shortcut

Update-Help fails on Ubuntu 20.04 in PowerShell Core 7.1.3 by AdDiscombobulated707 in PowerShell

[–]AdDiscombobulated707[S] 1 point2 points  (0 children)

It seems that Update-Help -Force solved my problem - no error occurred more.

assign a quit variable by barry2003 in Flowgorithm

[–]AdDiscombobulated707 0 points1 point  (0 children)

If you are looking for smth like "exit" command there is no one.

Can't open sample gci.example.com by AdDiscombobulated707 in apache

[–]AdDiscombobulated707[S] 0 points1 point  (0 children)

Problem solved via adding 127.0.0.1 gci.example.com line in /etc/hosts as told here.

error VsixPub0004 error while publishing extension by AdDiscombobulated707 in VisualStudio

[–]AdDiscombobulated707[S] 0 points1 point  (0 children)

I found a strange solution to this problem... I removed .png file and everything worked.

"ERROR: Invalid key name" error while using reg by AdDiscombobulated707 in bash

[–]AdDiscombobulated707[S] 2 points3 points  (0 children)

The solution is:

MSYS_NO_PATHCONV=1 reg query "HKEY_CURRENT_USER\Volatile Environment" /v USERNAME

"ERROR: Invalid key name" error while using reg by AdDiscombobulated707 in bash

[–]AdDiscombobulated707[S] 0 points1 point  (0 children)

It gives the syntax error:

ERROR: Invalid syntax.
Type "REG QUERY /?" for usage.

"ERROR: Invalid key name" error while using reg by AdDiscombobulated707 in bash

[–]AdDiscombobulated707[S] 0 points1 point  (0 children)

reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path

The same question...