Hacker News new | past | comments | ask | show | jobs | submit login
DuckDuckGo ES6 Cheatsheet (duckduckgo.com)
326 points by redox_ on Feb 22, 2016 | hide | past | web | favorite | 100 comments

I think people are missing the point. This isn't as much about ES6 as it is about DDG. For example:

- https://duckduckgo.com/?q=emacs+cheatsheet&ia=cheatsheet&iax...

- https://duckduckgo.com/?q=vim+cheatsheet&ia=answer&iax=1

Thanks for helping point this out! I lead community at DuckDuckGo and there are a lot more, "Instant Answers" that the world should know about. The community of open source devs really deserve a standing ovation for things like this (https://duckduckgo.com/?q=who%27s+in+space&ia=answer).

Check out the whole list of answers in development and live here: https://duck.co/ia

Most of what DDG is doing is great, and for a lot of things it's just as good as and often better than Google. It's really good to see how far you've come.

A few times I've found the instant answers are just plain wrong, and even though I've hit feedback they never got corrected. Hopefully you're trying to improve how you react to feedback? It's partly because you do so damn well on things like single link for a song lyric search, or just the answer snippet you need like an IP address, and highlight it better than Google that it becomes so noticeable when you do get something wrong.

I'd be hard pushed to remember a specific broken search to point you to as last time was around Christmas.

Hey Anex,

We're actively working towards improving feedback loops. But one of the best parts about our Instant Answers is they are open source. You, or others, can help submit new answers or correct them as part of our duckduckhack.com community. Some of our information comes from partner sites via an API and so if you find something wrong there it can take a bit longer to fix as we need to reach out to them and have it updated on their end.

As a team of 35 tackling a big problem like search we count on our community for help, but we do try and react to feedback as best we can.

If you ever seen anything grossly wrong, such as vandalized information or something malicious you can also report that to us more directly. Through our Instant Answer email at open@duckduckgo.com

Lastly, we really appreciate the feedback. Since we don't track users, we only get that type of feedback when you take the time to submit it or to post it here - so I want to let you know your voice is being heard and that we are indeed working through the feedback we get. Thanks for sharing it! :)

DDG team can be really slow with feedback.

Last year I submitted fixes for several bang searches, and I received an answer from them about three months later.

I didn't even know it was a "team"

But no emacs lisp, lisp, clojure, ruby, c(89|99|ansi) cheatsheets... very fishy!

You're more then welcome to submit one yourself.

In progress

elisp stub https://github.com/agumonkey/ddg_elisp_cheatsheet (waiting for #emacs input about curating elisp examples, so it's mostly empty)

A month or two ago I asked for a fix to FX queries (in the wrong part of github - in fact I probably did everything wrong as I know nothing of github) - within the day someone had added the new syntax parse.

Literally magic. <3

Tried Minecraft:

- https://duckduckgo.com/?q=minecraft+cheatsheet&ia=cheatsheet...

This could come in handy now that I know about it!

I also just learned people can make their own IA (Instant Answers) and contribute to DuckDuckGo:


This is their page to aid in DuckDuckGo's improvement.

The "shruggie" Instant Answer has been helpful with the rise of Slack et al.

I have a TextExpander macro for ¯\_(ツ)_/¯, which has improved my efficiency by several orders of magnitude.

All available IA (Instant Answers):


How do they generate these? Is it fully automated or all done by a human?

Really love it.

All human, made by a community of volunteers. There are currently about 200 cheat sheets: https://duck.co/ia?q=cheat

(Disclaimer: DuckDuckGo staff)

Instant answers are open sourced. :)

I'm not affiliated with DuckDuckGo, but I did develop a couple of them, like WordPress cheat sheet[0] and nmap cheat sheet[1]

[0] https://duckduckgo.com/?q=wordpress+cheat+sheet&t=canonical&...

[1] https://duckduckgo.com/?q=nmap+cheat+sheet&t=canonical&ia=ch...

When an instant answer is developed by some member of the community, you'll notice a small (i) icon on the right side of the instant answer. Once you click on it, you'll see the details about who developed it.

Seems to not work with the /html/ version[0]. It just gives a box with "HASH(0x5dfa858)" (for all the examples).

[0]: https://duckduckgo.com/html/?q=emacs%20cheatsheet

Yeah this is awesome if they keep doing stuff like this. The only reason I use google over ddg is cause google kills it with programming queries

This is true, but I recently switched to DDG as my primary search engine and have found that I can just add !g to any programming related queries (it redirects to Google). Best of both worlds, in my case.

And non English queries, those don't work at all. But g! makes me happy user anyway :)

I actually switched back to DuckDuckGo because I've found it's a better way to use Google than google.com

The cheat sheets and the bang commands are awesome. The no tracking by default is obviously a great benefit.

When the results are not as good, or I have a feeling Google will do it better, I just prefix with !g in the search bar and with no additional hassle I have myself a Google search.

My search engine life has never been this good.

> I actually switched back to DuckDuckGo because I've found it's a better way to use Google than google.com

Exactly my stance. Especially after setting DDG as the default search engine it is possible to directly search for an address or a translation via the address bar by

- "!osm [address]"

- "!gm [address]"

- "!dictcc smorgasbord"

That is pretty neat.

Just out of curiosity: how often do you find yourself using !g and then actually finding a better answer?

I'm not autoreleasepool, but IME, I find myself using !g about 5% of the time (counting only general searches, not things where I would be using another bang expression). About half of those times, it ends up giving me a better answer.

It's usually that the results are different, not better necessarily. I've done the reverse too; where I start with !g and then used DDG because I was unhappy with the results

For me it's about 10% of searches, using !gde mostly when I need localized results. That's about it.

Honestly, I've been using DuckDuckGo exclusively for a few years now, and I still don't use even half of the bangs or instant answer features. Occasionally the Wikipedia summaries are what I'm looking for, or I'll !define something.

My point being, even without the power user features, it's just a great search engine for everyday use.

Same here, long time ago switched to DDG and don't have many complaints. Except, sometimes devil really is in the details: duckduckgo.com is awfully long to type on mobile and it's a tiniest bit slower than google, which is a little annoying if you use it all day long while downloading something from torrents and so on.

For mobile, I've found ddg.gg much shorter to type than duckduckgo.com, and it redirects to the same place, so maybe that's a solution.

I don't have anything for the latency, though.

I found out, in a happy little accident, that dgg.gg also works.

Oh, thanks. I tried ddg.com and it didn't work, so I assumed there's no short version.

Why do you browse to it directly instead of using your browser's search bar?

For those that are looking for a reason to try DDG out:

I use the DDG plugin for firefox (https://addons.mozilla.org/en-US/firefox/addon/duckduckgo-fo...) -- and I get to type things like:

!hn duckduckgo

!python multiprocessing

!ud swagtron

in my addressbar and get pretty quick amazing access to a bunch of sites I know about on the internet without setting up my own custom search options on the browser itself. It has saved me tons of time and is an awesome feature.

Of course, there are more reasons to choose DDG, but I remember being pretty wowed when I first saw someone else use the one I just mentioned

I don't think you need a plugin for that? Anything typed in the address bar which doesn't look like an internet address will be sent to the default search engine by FF, so if that happens to be DDG you're ok.

That's absolutely right -- the plugin sets your default search provider, but if you just set it to DDG yourself (or search those phrases on duckduckgo.com), you would get those awesome features.

Are single quotes the preferred way of making strings nowadays then? It seems to be pretty common among new JS frameworks/libraries source code that I see nowadays.

    var asdf = "asdf";

    var asdf = 'asdf';
I really haven't been doing any JS programming for quite a while now.

My assumption is that for JS single quotes are used because double quotes are the standard for HTML, and this allows for easier use of JS code in HTML attributes for JS events (e.g. onclick="alert('foo');").

I assume JS allows both because of the languages that came before, such as Perl, where it was a convenience to make it easier to include either double quotes or single quotes (contractions) within a string without escaping (but Perl goes much farther than that with the q and qq operators).

In other languages, such as C/C++ single quotes aren't used for string, but for character literals.

I suspect it's mostly preference & less keystrokes (single tick requires no shift key). All the answers on stack overflow seem to indicated there's not really a difference:



Some languages (Perl and PHP) will interpolate variables in double-quoted strings. Getting in the habit of typing single-quotes defends against accidentally using variable substitution when you don't mean to.

But some other languages (C/C++) have different meaning assigned to single-quoted strings. Getting in the habit of typing double quotes will ensure you will always get a string.

And Ruby

On my Turkish Q keyboard, double quotes are the one keystroke and single quote is shift+2. Since I'm lazy I keep using double quotes when writing JavaScript.

I'm not exactly sure why, but that seems to be the case. It might be due to the ubiquitous AirBnB JS Style guide (https://github.com/airbnb/javascript) which enforces single quotes. It's the style guide we use on my team.

Single quotes have been mainstream in JS for much longer than AirBnB has been around. Take for example, the Google style guide[1]:

> For consistency single-quotes (') are preferred to double-quotes ("). This is helpful when creating strings that include HTML

Or take the oldest version of Prototype JS I could find (a JS library from the old days), version 1.5 from Jan 2007[2]. A simple search of the source shows 690 occurrences of ' and 48 occurrences of ". jQuery 1.0, dated 2006[3] is a counter example which has many more occurrences of double quotes, but I believe single quotes were generally more common even before that.

I think, in addition to the HTML thing mentioned already, PHP also had a lot to do with it, since single quotes would be encouraged in PHP when you just want a plain string.

[1] https://google.github.io/styleguide/javascriptguide.xml?show...

[2] http://prototypejs.org/assets/2007/1/18/prototype.js

[3] https://code.jquery.com/jquery-1.0.js

I'm not sure why/when the shift took place, but I do like it because it looks a lot cleaner than double quotes.

At work I use airbnb's linting configuration as shown here[1], which specifies the usage of single quotes for strings (no explanation for the preference though).

[1] https://github.com/airbnb/javascript

In speculating on reasons behind the preference, my best guess is HTML. It seems more natural/idiomatic to write:

    var el = $('<a href="/" class="link">Link</a>');
rather than

    var el = $("<a href='/' class='link'>Link</a>");
let alone

    var el = $("<a href=\"/\" class=\"link\">Link</a>");

In this particular case, I'd write

    var el = $("<a href=/ class=link>Link</a>");

Yeah it's a rule in a lot of style guides. Google for one example: https://google.github.io/styleguide/javascriptguide.xml?show...

I always found it bizarre that Python let you do both single and double quotes. It really goes against the whole "only one way" thing.

going to python from c# I noticed this.

A string in c# is "I am a string". Single quote, is used for a char 'a' and cannot be a string.

Yeah for the most part I believe there is a good amount of consensus around that.

Definitely the norm in my code.

Same here, in both JavaScript and Ruby. I guess single quotes are easier to type on standard keyboard setups, but I have never been a fan for some reason.

In Ruby, at least, there's a functional difference. Using single-quotes is a good way to indicate that a thing is just a string and not a template.

That's true. There's also the subtler functional difference in both languages that single quote strings can have unescaped double quotation marks in them and vice versa.

Ha, that's a good point.

Total side bar, but I always thought their brand name held them back. It really doesn't roll off the tongue in a way conducive to becoming a verb (ie. "Let me DuckDuckGo it" vs. "Let me Google it").

Curious how everyone else finds themselves working the brand name into discussions.

We've suggested people try saying "Duck it", but admittedly it's not in popular use just yet...

I agree with OP. The name isn't bad per se, but I too believe it ultimately puts a ceiling on DDG's growth and marketability. The fact is, it is awkward to use in a sentence, and it will dampen the rate of word-of-mouth marketing for that reason.

I'm not sure how tongue in cheek your remark is, but just in general if you think that trends in language, such as using a brand name as a verb, come from the top-down rather than appearing spontaneously and organically then you're on seriously the wrong track. There's a reason that people don't say 'duck it', that has nothing to do with you encouraging them to or not. You can't influence it at all really (well for sake of argument, assume that's true at least with anything but a world-leading marketing spend) - all you can do is set the seed for the brand to get used that way organically. At the moment it's not.

The branding thus far is a sunk cost. It's never too late to turn round, walk back, and take the other fork in the road if the fork you chose isn't going anywhere.

At the end of the day we look at it from the perspective of how we've come to be the startup that does things a little differently. Our headquarters is in a town of 5000 people in PA, we refuse to track our users even if it were more profitable, and we like our long quirky name. And, when you do use DuckDuckGo in a sentence people notice and it sticks with them because it is different.

We've grown 100% year over year, but at the end of the day our main focus is building a great product people love, that truly puts privacy first. Threads like this mean we're doing it right - we just want people to love being part of the flock!

> when you do use DuckDuckGo in a sentence people notice and it sticks with them because it is different

This is a good point, but I guess if a lot fewer people use it in a sentence to begin with than otherwise might, it won't provide much of an advantage in practice.

> our main focus is building a great product people love

This entirely sums up the point - DDG does things differently and that's great - going against the established grain with your product makes it what it is. But why go against the grain with your branding too? Aren't you just adding an orthogonal concern to deal with, that has nothing to do with what makes your product great?

I've corrected "duck" and "ducking" into certain profane terms so many times by now that I'd be afraid of autocorrect if I tried to use "duck it" regularly...

Here's a useful list of other shortcuts that DuckDuckGo provides: http://techglimpse.com/duck-duck-go-search-engine-goodies-tr...

Some of my favorites:

expand [shortened URL] - (ex: expand http://tinyurl.com/urlwiki) - See where a shortened URL points to

password [length] [weak/strong] - (ex: password 15 strong) - Generate a password of n characters (with the usual disclaimer about generating passwords from a website)

Related: We (DuckDuckGo) have a table of programming-related Instant Answers, including cheat sheets, that we're trying to complete here, so you can see what's currently available or waiting for a developer: https://github.com/duckduckgo/duckduckgo/wiki/Programming-IA...

VIM cheatsheet! Sweet.. https://duckduckgo.com/?q=vim+cheatsheet&ia=answer&iax=1 duckduckgo simply gets better everytime and I've made it my default search engine. And like someone mentioned, if I find the results inadequate, I just !g it.

Wish they had nano

I thought the point of nano is being usable without a cheatsheet.


ddg keeps getting better and better and better

go duck duck go!!

Revisiting duck duck go after having ignored it few years ago was a good surprise. I don't know exactly what changed or if the algorithm is good enough but it made me think about trying it again.

We encourage you to try it again for sure! We've even added a feedback button on the SERP. Despite our small size we move pretty aggressively on improving the search. In fact in the past year we've added hundreds of new Instant Answer sources and thousands of new !Bangs. So give us a test drive, set us as default for a week, let us know what is working for you and what isn't. I think one of the best parts about us, is that you can reach us. You can be engaged in this process and give feedback that helps build the search engine you want to see.

Wow, cool feature from DuckDuckGo, it seems to be working well. If you want more detailed cheatsheet for ES6 https://github.com/DrkSephy/es6-cheatsheet is a good one, I believe.

Is this cheatsheet, and similar ones for other languages, somehow dynamically generated by DDG, or are they just producing and maintaining this content themselves? If the former, bravo! If the latter I fail to see how this is a scaleable approach for a search engine?

These are all community-contributed. You can view all the JSON source files here: https://github.com/duckduckgo/zeroclickinfo-goodies/tree/mas...

and you can search for Cheat Sheets (and all other Instant Answers) here: https://duck.co/ia?q=cheat+sheet

I believe all of DDG's 'instant answer' systems are community created and maintained... https://duck.co/ia

This is a great question. DDG is open source, so someone should be able to figure that out.

EDIT: based on other answers, this is unnecessary. These are community contributions. Pretty cool!

If you're interesting in ES6, I highly recommend Exploring JS (http://exploringjs.com/)

It's all open-source. These are powered by simple JSON files, you're welcome to submit a LaTeX Cheat Sheet :)


I think we have over 200 cheat sheet now

If it's any consolation, there's a LaTeX quick lookup: https://duckduckgo.com/?q=latex+integral&ia=answer

Tried the Golang cheatsheet, the rendering is broken. lots of <br> tags


Well, this just reminded me how awesome DDG is and made me switch! Thanks :)

Is there a printable version? Would be far more handy on my wall/desk where I can reference it quickly.

Have you tried file -> print?

Have you? It isn't pretty when printed from Chrome or Firefox.


I agree, I would love to have a printable version

Is there some shortcut? "cheatsheet" is a long word to type.

You can type char instead or these other keywords in this file:


Maybe even ask for a new shortcut for cheat sheets.

tldr; You can use your keyword with any of these trigger words: 'char', 'chars', 'character', 'characters', 'cheat sheet', 'cheatsheet', 'command', 'commands', 'example', 'examples', 'guide', 'help', 'quick reference', 'reference', 'shortcut', 'shortcuts', 'symbol', 'symbols', 'key bindings', 'keys', 'default keys'

"read-only constants". This is a crazy thing to say and people are believing this.


"The const declaration creates a read-only reference to a value. It does not mean the value it holds is immutable, just that the variable identifier cannot be reassigned." [1]

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

I see a lot of complaints about this that I don't really understand. This is similar to final in Java, val in Scala, etc – sure, it's potentially referencing a mutable value, but you know it's not going to be reassigned.

You know that, but the happy-new-world ES6 tutorials out there do not. And I imagine the same about most people reading them.

I can't speak to the intent of the post you responded to, but to me constants are by definition read-only and so it sounded a little redundant to me

Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact