
Using Code Snippets in Chrome Developer Tools - akras14
http://www.alexkras.com/using-code-snippets-to-test-save-and-reuse-javascript-code-in-chrome-developer-tools/
======
kyriakos
In the 80s home computers shipped with a programming language as their OS
(BASIC language to be precise) - today the browser dev tools are the closest
equivalent. You can use them on any PC with no additional software - wished it
was made more obvious so everyone could experiment with programming like those
of us who got their first computer experience 25-30 years ago could do.

~~~
niftich
The browser has always been the one of the easiest ways of tinkering with
programming, but these days our browsers come with sophisticated developer
tools unlike anything else installed on an average person's PC.

Back when I didn't know anything about compilers I wanted to write 'C++' but
didn't understand how I could produce an executable, I instead saved html and
js into folder and loaded them up in the browser -- and any changes were
visible on refresh.

And actually, these days this tinkering doesn't even have to take place
locally. With sites like jsfiddle, anyone can develop remotely while still
being able to debug the execution from the browser.

~~~
rahimnathwani
1980s: Computers come with a BASIC interpreter

2000s: Computers come with a web browser that can run JS

2010s: Computers come with a web browser that can run JS and has some other
tools

But what was available in the early 1990s, when IBM-compatible PCs had become
cheap enough to have at home, but ~everyone ran DOS+Windows? I don't remember
there being any way (unless you count BAT files) to easily get started writing
programs.

For those who got their first taste of programming in the 90s, what language
and compiler/IDE did you use?

~~~
endgame
MS-DOS came with GW-Basic and later QBasic, and the latter lives on in QB64:
[http://www.qb64.net/](http://www.qb64.net/)

~~~
mabo
Thanks for mentioning QB64. While I haven't tried it out (yet), having an
integrated IDE and DOS emulation does sound pretty cool for nostalgia!

Personally, many many years ago when I was fed up with QB's limitations, first
versions of FreeBasic[1] were published and I made the switch. I haven't been
following its development closely for some years now, but it seems the
language has come a long way since then, e.g. supporting OO. It still can be
told to behave QB-compatible, though. Maybe this is interesting for anyone
looking for an open, more modern implementation of Basic.

[1]: [http://freebasic.net](http://freebasic.net)

------
acangiano
Speaking of text editors within browser dev tools, I like Scratchpad quite a
bit. [https://developer.mozilla.org/en-
US/docs/Tools/Scratchpad](https://developer.mozilla.org/en-
US/docs/Tools/Scratchpad)

It's built-in in Firefox, but can be installed on Chrome as well.

------
twic
Pretty cool. But surely not a patch on Firefox's built-in JavaScript editor,
which has autocomplete and inline documentation:

[https://developer.mozilla.org/en-
US/docs/Tools/Scratchpad](https://developer.mozilla.org/en-
US/docs/Tools/Scratchpad)

That said, something missing from both is an easy way to import and export the
code.

~~~
petepete
Chrome Dev Tools' editor has great autocompletion, and has done for a very
long time. Also, you can 'map' assets to local files so live modifications can
be saved without needing to import/export.

Dev Tools are what keep me using Chrome at work, they really are unparalleled.

------
dccoolgai
I have always loved Snippets and the whole Chrome Souces ecosystem in general.
In fact, I use Sources as my editor of choice over Sublime, Notepad++, etc. I
find the "map to local" feature outdoes anything I use from the other editors.
Only gripe is I wish snippets were stored as text files (or at least that was
an option)... couple weeks ago my Chrome profile got corrupted and I lost like
a year of snippets.

------
adamnemecek
I discovered it back when this came out and pentesting has never been the
same.

------
4684499
Is that possible to run these snippets automatically once page is loaded? I
guess this will raise some security issues if it's possible, but I don't want
to use things like Tampermonkey anymore.

~~~
kuschku
There used to be, but it was removed years ago. The official suggestion is to
use Tampermonkey instead.

------
foota
I was showing this to my coworkers the other day, they thought it was great.

------
stefanwlb
Are the snippets saved to the google account as well, so that I can access
them anywhere I sync my chrome dev browser?

------
Nickersf
Love it. Been using for a while now.

------
mxuribe
I never knew this; quite handy!!

------
ben174
Not sure this is "hidden". Anyone who has spent ten minutes poking around
chrome dev tools is likely to have discovered this.

~~~
cobalt
yeah, I love to put little tools i write in here like Angular js debug
functions

~~~
zachsnow
Any examples you'd care to share?

------
stephenr
I know a lot of developers basically treat Google as Jeebus returned, and
therefor infallible, but this just seems like unnecessary bloat.

What's next, a JS minifier built into Chrome, so 1% of users can use it as an
IDE while everyone else just gets more shit they don't need or want?

~~~
Kalroth
The editor is necessary to the Chrome Developer Tools, since you can edit
existing pages and debug the changes. The Code Snippet functionality is
however not necessary (in my opinion), but it's such a small part of Chrome
Developer Tools that I'm not sure it qualifies as bloat.

