It always blew my mind how some developers could simply sit down and write code for hours on end.
I wanted to be that developer. I wanted to be the guy who just sat down and churns on code for eight
hours a day. Well it turned out that the reality is a little bit different. This video is sponsored by me.
If you want to have a mentor go ahead and check out rebeloper.com/mentoring. Let's meet on a Zoom
call and find out your bugs or learn SwiftUI. It's at rebeloper.com/mentoring. Now let's get back
into the video and learn how I write code with hours on end without taking a break. Before I get
into the 12 tips that I like to use to code for hours on end let me ask you this question. Do you
really want to code for hours and hours without any breaks? Well if the question is yes then most
probably you want to do this because you want to get into the state of flow. Now if you don't know
what the state of law is well that is something that has been introduced by Mihály Csíkszentmihályi.
And yes, that is how it is pronounced. Well actually in Hungarian it's the other way around the first
name and last name are kind of reversed it's Csíkszentmihályi Mihály but anyway the Flow has been
introduced by Mihály Csíkszentmihályi and it's kind of like think of it like. You are indestructible you are in the
state of Flow. Most probably you already been there but you didn't really realize it and this
could take from 12 minutes or up to one hour, two hours, three hours long. It all depends on how
easy or often are you distracted. So if you do want to code for hours make sure that you check out
Mihály Csíkszentmihályi's book, it's called Flow and you will learn a lot more about that and why it's so
beneficial to work in the state of work. Basically I do want to get into the state of work so here
are my 12 tips and tricks. First of all number 12 is find your six hours in the day. Now as much as
we'd like to code for more than six hours let's say 8, 10, 12 hours, it's basically impossible to
do that in a state of flow. Basically maybe you are in the front of the computer for 10 hours but
active work will not be more than six hours. Six hours is kind of the most that I can think
of being in that state of workflow being really productive. Now you want to find these six hours.
It could be a one chunk so it should be just I don't know from 10 a.m till 4 p.m. but you could just chunk
it out throughout your day. It could be one hour in the morning or three hours in the morning then
three hours in the evening. It all depends on your schedule or of course if you're an employer
then you might want to put these six hours into your a day work. Now that is how you start off.
You want to get your schedule up. You want to know when you are coding and that's because when
you just do this over and over again it becomes a habit, therefore you will sit down much more
easily and you will get into that state of flow. So habits are really important to start this state of flow.
Number 11 is this one get blue light glasses. I couldn't tell you enough how much I love
these glasses. It does have some blue light shield of course that comes from my computer
and it's making my eyes really, really like it doesn't bother my eyes that much as if I wouldn't
have this. Of course these are subscription glasses so yeah just put them on but if you don't wear
glasses go ahead and buy a glass, it's like a sunglasses but for a blue light. It's your eyes
will thank me later. Number 10. Have your water at your desk. Now this is really important because you
want or will sit at your computer for hours on end you don't really want to get up and get a sip of
water or get a glass of water. Now what you can do is bring your water with you so you stay hydrated
and of course staying hydrated is really, really important because yeah that's what we all do all
day long, we just sit at the computer and most probably you don't drink as much water
as you should. Number 9. Get a comfortable chair. Now I'm using Varier Variable. It's the original
kneeling chair. It's really, really amazing, it helps me balance my posture. It doesn't hurt my back
So after I switch to this really, really amazing chair. It's really strange but it is really amazing for
my back I never turn back. Number 8. Step end up every 30 minutes and walk around for a few minutes.
Now this is kind of counterintuitive because if you are in a state of flow then you don't want
to interrupt yourself, well that's okay but once you see that you are getting out of that flow,
so you get a little bit distracted by some noise or something else then do you get up at least
in the 50 minutes period. And why is that? Well because you do want to exercise a
little bit, like not exercise but just move around, you don't want to sit those six hours all day long.
Number 7. Set do not disturb on. Now I mean it set do not disturb on and on all of your
devices, be it your phone of course because we are constantly getting look, testing on our phone.
Also set your do not disturb on your phone and also on your computer. It will help you quite a
lot and of course if your not notification comes in then your flow state is
really, really like messed up. So you don't want to do that. You want to avoid distraction at all cost.
Do not disturb is a really a good way of doing that. Number 6. Shortcuts. Now I use Command + Tab
or Shift + Command + Tab quite a lot because I have more screen, it's just one laptop, I don't have
those large curved screens or or extra monitors and therefore I use, if I use and most probably
you to use a lot of tabs, a lot of open windows then just use Command + Tab or if you want to go
back Shift + Command + Tab. It will save you a ton of time and a ton of frustration of moving between
windows. Also on the shortcut size I use Command + Space quite a lot to open spotlight,
so I can just search for let's say a project or another file that I'm looking for maybe an image
or something like that. Command + Space. So Command + Tab for switching between windows
and Command + Space for search. Number 5. Now this is a game changer. Dark mode. Enable dark mode on your
computer it will change the way that you look at your computer and it will change the way you code
forever. Now I had dark mode enabled for ages even when we didn't have dark mode I tried to
do a theme for all of my let's say Xcode or if it was possible I tried to do a dark mode
whenever I could because that white light it hurts my eye. I cannot do it. So dark mode Number 4.
If you are on a dark mode then you would definitely want to have for Xcode. I do have a dark theme
it's called Rebeloper One Dark Theme and with that comes a Fira code font. Go ahead and check it
out I do have a separate video on how to use that. It's free of use and it it is really, really like
colder like. I really like it. Go ahead and check out the video. The video will be linked down in
the description. Number 3. Another Xcode hint. Hide the canvas, hide the inspectors and sometimes
hide the navigation tab also because you want to code. So any other space that might distract you
or doesn't have any real application should be taken away. All I have now is just the code and the
code only. so I hide all of the other stuff. Also on Xcode, number 2. Use the built-in source control.
Now this is really amazing about Xcode. It has Xcode, it has GitHub already built in so it's
really, really straightforward and easy to use. I just go up and source code commit, source code push
or source code pull. It's really, really amazing and it's a time saver and of course if you don't
want to get out of your state of flow then you want to make these optimizations also. And finally
my number 1, go ahead and do not listen to music that has lyrics in it. So usually I just go
ahead and add a Lo-Fi playlist or if I don't want to listen to music I just use Noisli background
sound generator or I just add in some white noise. Again it's a Lo-Fi playlist or if I want to
not listen to any music at all because I need to concentrate that much I just use Noisli. Now what
if you don't have six uninterrupted hours that you can cover in. Now that may be the case because
maybe you're working from home, maybe you just have one hour at the office or two hours uninterrupted
space for yourself. Well there's a solution for that and that is what I like to call the five
minute developer. If you have five minutes maybe 10 minutes or 15 minutes go ahead and sit down at
your desk. Make sure that it's on the same desk and of course bring a bottle of water
and make sure that you make a habit out of it. That is the really important part here because
if it's a habit then you are going to get into that state of flow really, really quickly. Even if
it's five minutes. In five minutes you can do a lot if you do it each and every day or even multiple
times per day. Now if you did like these 12 tips and tricks on how you can get into the state of
flow and code for hours then most probably you will love my other video or where I talk about the 10
one-liners in SwiftUI that will blow your mind. Go ahead and check it out it's right over here.