{
"name":Himalay Sunuwar,
"bio":I'm a programmer from Himalayas, I listen to Metal and eat Rice. No I don't smoke, drink, or do drugs.,

Keeping code snippets handy in Chrome DevTool

Himalay Sunuwar
Himalay Sunuwar
November 8th, 2017 · 1 min read

We can save any piece of JavaScript as Snippet in Chrome DevTool and we can run it on DevTool console any time we need.

To get to the Snippets, we have to go to the Sources tab on DevTool then click on the right double angle. Under the Snippets sub-tab, we can add multiple pieces of JavaScript code in separate snippets.

For example, we can add a snippet that toggles all the Checkboxes in the page.

1;[...$$('[type="checkbox"]')].forEach((x) => {
2 x.checked = !x.checked
3})

In order to execute a snippet, we can right click on the snippet then click on Run on the menu, or we can quickly execute a snippet by pressing Cmd + Shift + P for Command Menu popup on the DevTool and entering ! followed by the snippet name.

Devtools-snippets page contains a handful of useful snippets collection.

2

More articles

Best MoMo place in Kathmandu

Everyone loves Mo:Mos in Kathmandu. It's a love that dares speak its name over and over again.

January 20th, 2017 · 1 min read

Post JSON data using cURL command

In this post I would like to show how to make post request with `JSON` data using `curl` cli tool.

July 23rd, 2016 · 1 min read
"social":
{
"github":@himalay,
"linkedin":@sunuwar,
"twitter":@HimalaySunuwar,
"instagram":@HimalaySunuwar,
},
"sitemap":/sitemap.xml,
"rss":/rss.xml
}