Snippets Collections
def extract_js_image(image_node)
  return unless image_node
  
  thumbnail_id = image_node["id"]
  return unless thumbnail_id
  
  if (found_thumbnail = extracted_thumbnails[thumbnail_id])
    JSUtils.unescape(found_thumbnail)
  end
end
def extracted_thumbnails
  return @extracted_thumbnails if @extracted_thumbnails.present?
  
  js_image_regexes = JS_IMAGE_REGEXES.detect { |key, _| engine.starts_with?(key.to_s) }&.last || JS_IMAGE_REGEXES[:all]
@extracted_thumbnails = js_image_regexes.collect { |regex|
    regex_capture_names = regex.names
thumbnail_index = regex_capture_names.index(THUMBNAIL_CAPTURE_NAME)
    thumbnail_id_index = regex_capture_names.index(THUMBNAIL_ID_CAPTURE_NAME)

    html.scan(regex).collect do |match|
      found_thumbnail = match[thumbnail_index]
      found_thumbnail_id = match[thumbnail_id_index]

      found_thumbnail_id.split(",").map { |thumb| Hash[thumb.tr("'", "").squish, found_thumbnail] }
    end
  }.flatten.inject(:merge) || {}
end
"search_metadata": {
  "id": "601d8c728f13dadfc5b57e18",
  "status": "Success",
  "json_endpoint": "https://serpapi.com/searches/6eccd428d7da60f9/601d8c728f13dadfc5b57e18.json",
  "created_at": "2021-02-05 18:20:34 UTC",
  "processed_at": "2021-02-05 18:20:34 UTC",
  "google_url": "https://www.google.com/search?q=Coffee&oq=Coffee&uule=w+CAIQICIaQXVzdGluLFRleGFzLFVuaXRlZCBTdGF0ZXM&hl=en&gl=us&sourceid=chrome&ie=UTF-8",
  "raw_html_file": "https://serpapi.com/searches/6eccd428d7da60f9/601d8c728f13dadfc5b57e18.html",
  "total_time_taken": 1.38
}
import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {
  let openWebview = vscode.commands.registerCommand('exampleApp.openWebview', () => {
    const panel = vscode.window.createWebviewPanel(
	'openWebview', // Identifies the type of the webview. Used internally
	'Example Page', // Title of the panel displayed to the user
	vscode.ViewColumn.One, // Editor column to show the new webview panel in.
	{ // Enable scripts in the webview
		enableScripts: true //Set this to true if you want to enable Javascript. 
	}
	);
  }
  context.subscriptions.push(openWebview);
}

function getWebviewContent() {
  return `<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Example Webview</title>
</head>
<body>
   <h1>This works!</h1>
	//Add some custom HTML here
</body>
</html>`;
}
... 
 "contributes": {
    "commands": [
      {
        "command": "exampleApp.openWebview",
        "title": "Open webview" // This is the command users will type in Command Palette to open the webview
      }
    ]
  },
...
{
  "name": "@my-org/bar",
  "version": "1.0.0",
  "description": "A test package to be published on my private Gitlab instance",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Arman Safikhani",
  "license": "ISC"
}
{
    "compilerOptions": {
        "baseUrl": "src"
    }
}
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      // "processId": "${command:PickProcess}",
      "protocol": "inspector",
      "restart": true,
      "name": "Launch Programa",
      "skipFiles": ["<node_internals>/**"]
    }
  ]
}
"pages": [
	{
		"id": "references",
		"content": "<div style='width: 1024px; height: 580px; background-color: #fafafa;'><div style='padding: 20px;'><b>Sources:</b><br/><br/>Active LCDs, Noridian Healthcare Solutions.<br/>https://med.noridianmedicare.com/web/jeb/policies<br/><br/>Chapter 13 – Local  Coverage Determinations, Medicare Program Integrity Manual, Centers for Medicare & Medicaid Services.<br/>https://www.cms.gov/Regulations-and-Guidance/Regulations-and-Guidance.html<br/><br/>Indexes, Centers for Medicare & Medicaid Services.<br/>https://www.cms.gov/medicare-coverage-database/indexes/national-and-local-indexes.aspx<br/><br/>Local Coverage Determinations Create Inconsistency in Medicare Coverage, Office of Inspector General, Department of Health and Human Services.<br/>http://oig.hhs.gov<br/><br/>Medicare Coverage Determination Process, Centers for Medicare & Medicaid Services.<br/>https://www.cms.gov/Medicare/Medicare.html<br/><br/>Regional Map, CMS Regional Offices, Centers for Medicare & Medicaid Services.<br/>https://www.cms.gov/About-CMS/About-CMS.html<br/><br/>United States Department of Health and Human Services.<br/>www.hhs.gov</div></div>"
	}
],
{
  "status": "Successful",
  "message": "The transaction was processed successfully",
  "data": {
    "provider_response_code": "00",
    "charge_status": "Processing | WaitingForOTP | ProcessingOTP | Successful | Failed | OfflineValidated | OfflineNotified",
    "provider": "Quickteller",
    "errors": null,
    "error": null,
    "charge_token": "Kz5Dev7BenV9HmLNB"
  }
}
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Deny",
            "Action": [
                "codecommit:GitPush",
                "codecommit:DeleteBranch",
                "codecommit:PutFile",
                "codecommit:MergePullRequestByFastForward"
            ],
            "Resource": "arn:aws:codecommit:us-east-2:80398EXAMPLE:MyDemoRepo",
            "Condition": {
                "StringEqualsIfExists": {
                    "codecommit:References": [
                        "refs/heads/master"   
                    ]
                },
                "Null": {
                    "codecommit:References": false
                }
            }
        }
    ]
}
Escapes or unescapes a JSON string removing traces of offending characters that could prevent parsing.

The following characters are reserved in JSON and must be properly escaped to be used in strings:

Backspace is replaced with \b
Form feed is replaced with \f
Newline is replaced with \n
Carriage return is replaced with \r
Tab is replaced with \t
Double quote is replaced with \"
Backslash is replaced with \\
{
  "name": "portfolio",
  "version": "1.0.0",
  "description": "Serhii Yakymenko Site potrfolio.",
  "main": "gulpfile.js",
  "dependencies": {
    "browser-sync": "^2.26.7"
  },
  "devDependencies": {
    "gulp": "^4.0.2",
    "gulp-sass": "^4.1.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/serhii-edit/portfolio.git"
  },
  "author": "Serhii Yakymenko",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/serhii-edit/portfolio/issues"
  },
  "homepage": "https://github.com/serhii-edit/portfolio#readme"
}
var profile = {
  name: 'John',
  age: 25,
  isAdmin: false,
  courses: ['html', 'css', 'js']
};

var person = JSON.stringify(profile);
var contacts = '{ "people" : [' +
'{ "firstName":"Joe" , "lastName":"Smith" },' +
'{ "firstName":"Tom" , "lastName":"Hardy" },' +
'{ "firstName":"Ben" , "lastName":"Stiller" } ]}';

var newObject = JSON.parse(contacts);

import org.json.*;


JSONObject obj = new JSONObject(" .... ");
String pageName = obj.getJSONObject("pageInfo").getString("pageName");

JSONArray arr = obj.getJSONArray("posts");
for (int i = 0; i < arr.length(); i++)
{
    String post_id = arr.getJSONObject(i).getString("post_id");
    ......
}
var eventsVariable = '"{events":[' +
    '{"location": "New York", "date": "May 1", "public": "true"},' +
    '{"location": "London", "date": "Apr 24", "public": "false"},' +
    '{"location": "San Frans", "date": "Nov 30", "public": "false"}]}';
    
star

Wed Feb 10 2021 23:59:49 GMT+0000 (UTC) https://jsonplaceholder.typicode.com/

#json
star

Tue Feb 09 2021 10:06:00 GMT+0000 (UTC)

#json #ruby #webscraping #serpapi
star

Tue Feb 09 2021 08:51:45 GMT+0000 (UTC)

#json
star

Wed Feb 03 2021 16:55:32 GMT+0000 (UTC) Mishka.codes/webviews-in-vscode

#json
star

Wed Feb 03 2021 13:29:03 GMT+0000 (UTC) Mishka.codes/webviews-in-vscode

#json
star

Tue Dec 29 2020 20:07:46 GMT+0000 (UTC)

#package.json #json
star

Sat Nov 14 2020 15:33:29 GMT+0000 (UTC)

#json
star

Wed Nov 11 2020 12:56:36 GMT+0000 (UTC)

#json #nodejs #debug
star

Mon Nov 09 2020 18:38:02 GMT+0000 (UTC)

#json
star

Tue Sep 01 2020 17:21:03 GMT+0000 (UTC) https://v1.docs.onepipe.io/

#json
star

Wed Aug 26 2020 15:53:02 GMT+0000 (UTC) https://aws.amazon.com/blogs/devops/refining-access-to-branches-in-aws-codecommit/

#json
star

Mon Aug 17 2020 21:58:29 GMT+0000 (UTC) https://www.freeformatter.com/json-escape.html

#json
star

Mon Jun 29 2020 22:56:30 GMT+0000 (UTC)

#json
star

Thu Dec 26 2019 16:01:30 GMT+0000 (UTC) https://stackoverflow.com/questions/2591098/how-to-parse-json-in-java

#java #howto #json

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension