DEV Community

Ben Halpern
Ben Halpern

Posted on

What do you Google EVERY. SINGLE. TIME. and never just memorize?

Top comments (248)

Collapse
 
val_baca profile image
Valentin Baca • Edited
  • Converting Array<->List in Java*. Been coding Java for 6+ years and still don't care to learn/memorize this.
  • Objective-C block syntax

  • bash test format and flags

  • vim macro create and execute

I noticed I could never remember these, so I always make aliases, shell functions, or short ~/bin/ scripts for them instead:

  • tar: xkcd.com/1168/

  • netstat flags (other than "-tulpn" which I have memorized as "tull-pin" like "Tolkien")

  • ssh tunnel syntax

Edit: *in one-line.
Array to list:

String[] array = ...;
List<String> immutableList = Arrays.asList(array);
List<String> mutableList = new ArrayList<String>(Arrays.asList(array));

List to array:

List<String> list = ...;
String[] array = list.toArray(new String[list.size()]);

Clear as mud...

Collapse
 
ibibgor profile image
Oscar

Helpful protip. I learned yesterday, that list.toArray(new String[0]) is faster than the version with the explicit size given.

Collapse
 
lynnetye profile image
Lynne Tye

I was about to write the same thing. How to vertically align elements... without using flex 😂

Collapse
 
sarah_chima profile image
Sarah Chima

Regex. While I understand how it works and how it can be used, it's difficult for me to memorize the right regex that should be used at every point. So I just google whenever I want to make use of it. :)

Collapse
 
ben profile image
Ben Halpern

Oh yeah that's a big one

Collapse
 
inozex profile image
Tiago Marques

I was just like that... but then I've found regex101.com/ and now, I'm almost proficiente writing regex!

Collapse
 
arakawadotca profile image
gustavo

regex101 is the single best resource I've ever found for regex.

Collapse
 
miffpengi profile image
Miff

It's funny in my case. I know enough regex to get by, but I generally need to google to find out how to actually apply it.

Do I need RegExp.prototype.test or String.prototype.match in JS? What are the order of parameters in preg_match in PHP? What are the little parentheses things called in .NET, captures or groups?

Collapse
 
redgreenrepeat profile image
Andrew

I had the same problem, until I found Rubular:

rubular.com/

Bonus tip: making a permalink will also save all the test cases used. Makes for an excellent inline comment!

Collapse
 
kwabenberko profile image
Kwabena Bio Berko

Me too!
Hahaaahaa

Collapse
 
rogerpaviani profile image
Roger Paviani

Same here...
BTW, I knew someone must've been written about regular expressions when I read the title.. 😂

Collapse
 
georgeoffley profile image
George Offley

I always have to Google regex. Or copied old code.

Collapse
 
jeansberg profile image
Jens Genberg

I can never remember how it works either. I found this to be helpful, though! regexr.com/

Collapse
 
reyabreu profile image
Reynaldo Jose Abreu • Edited

Same here. I can only remember $,,*,+ and /s /w. I always end up up googling an example and going from there.

Collapse
 
ben profile image
Ben Halpern

For me it's "manually start postgresql"

Every once in a while my postgres server isn't running and I know to punch that into my browser and land on this Stack Overflow question, where I proceed to copy this command into my terminal:

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

It happens infrequently enough that I never bother to alias it or remember how to type it out. I just remember what to Google.

Collapse
 
galdin profile image
Galdin Raphael

I have postgres installed via homebrew. So I use brew info postgres to copy the start command :)

Collapse
 
lepinekong profile image
lepinekong

So did I then I realize how many precious minutes of my life I'm losing so I decided to buy a domain for 75 cents mycodesnippets.space :) I write things down little by little as soon as I need it the first time or I risk to never do it by lazyness !

Collapse
 
kaustav1996 profile image
Kaustav Banerjee

cant you just sudo service postgresql start ? :P

Collapse
 
shelbyspees profile image
shelby spees (she/her)

On Linux, yes. On OSX, no unfortunately.

Collapse
 
svemaraju profile image
Srikanth

I was gonna say this. Have bookmarked the stackoverflow post on this. :D

Collapse
 
samxeshun profile image
Kwaku Eshun

Oh yes, I even googled and used this today because my service keeps stopping.

Collapse
 
aminarria profile image
Amin Arria

How to make a tar file...

Collapse
 
damian profile image
damian

at least extracting is easy (say it in a german accent) tar -xzf "xtract ze files"

Collapse
 
cdw9 profile image
Chrissy Wainwright

and -czf == 'compress ze files'

Collapse
 
aminspeaks profile image
Amin Mohamed Ajani

well what works for me is tar -xzvf "xtract ze vucking files"
No kidding that's how remember it

Collapse
 
aminarria profile image
Amin Arria

That's a great way! Jajajaaj

But it's important to note that tar is smart enough to detect the format so I prefer the general tar -vxf

Collapse
 
dean profile image
dean

Thank you so much.

Collapse
 
loilo profile image
Florian Reuschel

Even though as a German with decent English pronunciation this is a little bit insulting, I'll probably never forget this ever again. Thanks! 🙈

Collapse
 
jgauffin profile image
Jonas Gauffin • Edited

Isn't that for zipped tar files? -xzf = extract zipped (tar) file.

Collapse
 
tbodt profile image
tbodt • Edited

xkcd tar

Collapse
 
baamenabar profile image
B. Agustín Amenábar Larraín

I threw this one at a dev I used to work with. He answered instantly, he could have disarmed 2 bombs with that speed.

Instant respect gained

Collapse
 
sanjay555 profile image
Sanjayshr • Edited

I figured out how to remember it. To create tar, use c option and for extracting replace c with x ==> $tar will remain same for both Lol :) . tar -cvf filename.tar file/dir_path && tar -xvf filename.tar.

Collapse
 
brandonhowkins02 profile image
brandonhowkins02 • Edited

Hey, I also want to make a tar file for my website name:Lenny face. Let me know if the given suggestions works for you!

Collapse
 
jacoby profile image
Dave Jacoby

sed and awk and how to use them.

Collapse
 
ttiger profile image
Tony
  • Creating SSH Keys
Collapse
 
kyslik profile image
Martin Kiesel

I just ssh-k ↑ in zsh and just list all previous key generation commands or if I am not sure what I am looking for I use fzf

# fh - repeat history
fh() {
  print -z $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
}
Collapse
 
kunde21 profile image
Chad Kunde

I was helping someone with this earlier this year. Ended up creating a helper for it:

gist.github.com/Kunde21/3633e1e9ef...

Collapse
 
math2001 profile image
Mathieu PATUREL

Suprised tldr didn't got mentioned.

It's a pretty neat tool to do this kind of things...

Collapse
 
imthedeveloper profile image
ImTheDeveloper

Best link I've seen all week. Heroic!!!!!

Collapse
 
scottfred profile image
@ScottFred

That's awesome! thanks

Collapse
 
aidanharding profile image
Aidan Harding

Javascript array methods. Is this one in-place, or returning a new array? I don't know, but MDN does!

Collapse
 
andy profile image
Andy Zhao (he/him)

And centering things. Completely clueless every time.

Collapse
 
redgreenrepeat profile image
Andrew

here's a handy multiple choice questionnaire!

howtocenterincss.com/

Thread Thread
 
theminshew profile image
Michael Minshew

holy crap, whoever made this site needs a medal. Great recommendation!!!

Collapse
 
z0al profile image
z0al

How to extract tar.gz file in Linux command line!

Collapse
 
dean profile image
dean • Edited

Saw a comment from above and it changed my life.

tar -xzf filename xzf = "Xtract Ze Files!" (german accent)

Collapse
 
erwandavid profile image
ErwanDavid

Excellent, noté that you may get ride of the dash.

Collapse
 
galdin profile image
Galdin Raphael • Edited

tar -xf filename

Read as tar eXtract File filename.
Saw this on an SO answer and never had to google it ever again :)

Collapse
 
z0al profile image
z0al

Wow, I never thought of it.

Thanks :)

Collapse
 
hmemcpy profile image
Igal Tabachnik

How to delete a remote branch in git.

Collapse
 
itsasine profile image
ItsASine (Kayla)

Cherry picking commits in git, because I can never remember if it's cherrypick or cherry-pick

A more efficient way would be to just do it and correct if it errors, or alias it to git cherry or something

Also, how to exit vim, and how to insert in vim, and basically how on Earth did I end up in vim omg get me out

Collapse
 
eljayadobe profile image
Eljay-Adobe

I've been using Vim now for about 24 years. Primarily because I don't know how to quit.

Collapse
 
binaryforgeltd profile image
Bart Karalus

I would be responsible for 95% of hits coming from google search into the Tutorialpoint's html5 minimal template. Now I could easily type it in every time I set up a new page, but it is now a matter of extreme laziness I think.

Collapse
 
sake_92 profile image
Sakib Hadžiavdić

How to "unignore" files with git... Here is a nice and short way.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.