Jerod, Nick, KBall, and Chris pre-party for JSConf by testing out some brand new segment ideas: Story of the Week, What the WHAT⦠WG, and Protip Time. What do you think of these segments? Like āem? Love āem? Not sure why we even? Please let us know!
Christopher Hiller: I have some pro tips⦠I use a Mac. If you use a Mac, maybe a thing you need to do is copy and/or paste text files (source files or what have you) in their entirety. I discovered not too long ago - maybe this is one of those things that everybody knows except me, but I discovered that there were actually a couple command line tools that come in Mac OS that help you do just this thing. They are pbpaste and pbcopy.
[52:16] Pbpaste outputs to a STDOUT. It takes whatever is in the clipboard, and it sends it to STDOUT so you can pipe it to whatever you wanna pipe it to. Maybe you wanna pipe that to a file, and so if you copy some source and then you go to your command line and you say pbpaste, and then you do a write ā I donāt even know if thatās less than or greater than [laughs], but youāre piping to the right with the direction, and you say foo.js⦠It will paste the contents of your clipboard into a new file, foo.js.
I wrote a little tiny Zsh function called Paste, which does just this - it takes its first parameter and it says āpbpasteā, and it writes to this new file. So I say āpaste foo.jsā, it takes whatever is in my clipboard and throws it in a new file, foo.js.
Likewise, pbcopy - you can cat a file and then pipe it to pbcopy and that fileās content will end up in your clipboard. Again, I wrote a little function to help with that, so it just accepts its first parameter, and it cats it (this file) and it pipes it off to your clipboard, which is really cool.
Along the same lines, thereās another little thing called z, and people may or may not know about z; maybe weāve talked about z before, I donāt know⦠But thereās this command line tool for your shell called z. Just search GitHub for z.
It basically looks at all your shell history, it looks where youāve been, and if you say something like āz nodeā or something, it will find the last directory that you were in called Node and it will just pop you right back there. Itās a great way to navigate to frequently visited directories or working copies, and itās really neat.
Another tool I use is called ā and apparently thereās science behind this; I canāt say whether or not thatās true, but itās brain.fm. Itās a service that you pay a nominal fee for and they give you a mobile app and a web app. The best way to maybe explain it is itās generative music; thereās many different styles, but⦠Thereās some science behind it that says āIf you listen to this music, itāll help you, for example, focus on a task, or itāll help you relax because of various tones and tempos and frequencies in the music.ā
I donāt know about that, but I wanted to try it, and so I did try it, and I found out that itās really helpful when Iām trying to focus on coding, and it helps me get and stay into the flow.
I feel like if you do a lot of coding, maybe you recognize that sometimes you get into this flow state and I feel like the music generated by brain.fm may help you do that; maybe it wonāt, maybe youāll find it boring, but itās supposed to be actually kind of ā itās not supposed to engage to engage with you. Itās supposed to be kind of in the background.
A lot of popular music, or even maybe you listen to ā I donāt know, techno, or trance, or something with that beat⦠It kind of drives you forward to help, but maybe sometimes that type of music is a little too engaging, and the brain.fm music is like Techno Elevator music, or something⦠Itās really interesting; you just throw it on the background, forget about it⦠And it helps me focus. Check that out, itās cool.
[56:31] The last thing - there is a thing called Astral. If youāre like me, you have a million GitHub stars and you may be like āWhat was that thing I was thinking of? How do I find it?ā I donāt even know how to do that with GitHub⦠So thereās this app called Astral App. Itās astralapp.com. Itās just like an OAuth style GitHub app, and it helps you manage and view all your stars, and you can even tag your stars into categories, and it sorts stuff by language, and itās really neat.
So if you are like me and have a lot of stars, check out Astral App, and that will help you manage them and find things. Those are my pro tips.