Ask HN: How do I code offline for a week?

58 points by lucasknight ↗ HN
I'm going to be going to the middle of nowhere for a couple of weeks, and there's going to be no internet there.

I design with Figma and I code in React Native/ReactJS. How can I build something or learn a skill with no internet to make sure I'm productive over this time?

88 comments

[ 4.2 ms ] story [ 253 ms ] thread
Starlink?

Not meant to be snarky, sorry I just don't have any idea how you'd get local setups and then have the relevant developer docs in an accessible manner. Maybe a locally running Llama model?

print it all on paper and design and code on paper.
Do you really need to code on a vacation? (I assume this is not a job-related trip if the destination is the middle of nowhere.)
Do it localhost? Make sure you download all dependencies before you go offline
Try another language for the time you’re away. I spent 2 weeks in hospital and spent it offline playing with PICO-8 by downloading the PDF references and just experimenting.

Doesn’t need to be PICO-8 but there’s plenty of languages that can be done entirely offline.

Still keeps your brain active and lets you learn something new that might help you in parallel ways.

grab a textbook and work through it
I don't know the circumstance of your tech exile, but I'd encourage you to take advantage of it to do something other than code! If you're going to be in nature, be in nature. If you're going to be with people, be with people. Those are the sorts of experiences you'll treasure, later in life, far more than a few more days of "productivity".

If none of that applies, and you still want to learn something to do with tech? Well, you know this won't be an ideal situation to engage directly with a system. How about zooming out a bit? Read some books. Some of Stallman's essays. Clifford Stoll. Or anything else more recent that you think is big-picture significant to your field. Your situation will be ideal for contemplation, which will in the long-term make you a better contributor to whatever projects you take on.

It's really annoying to answer a question by telling the asker that you know better and they should do something else. This person cared enough about this question to ask it to a community on the internet. Have the humility to answer their question instead of telling them that you're wiser than them.
Tell me that in the real world, if you ask a question, you will get only answers and no opinions.

Internet is the same. You ask and someone made the effort to voice their opinion on something and you have to put the effort into figuring out if they would fit your situation. If not, continue on.

Yes, but programmers are a special case. We all know that our industry is characterized by a pervasive desire to prove we know more than others. So we should rein it in more than elsewhere.
Tell me about it. Lots of people do it, but there’s something about programming that brings the alpha nerds that think contrariness is by itself interesting or impressive. So boring to talk to these people — it’s impossible to build common ground as they will disagree or argue a point not because they actually believe their case, but because they think that’s how you sound smart in a conversation.

Nope, you just sound like an asshole.

The 'do something else' is the community caring. Perhaps it's incorrect, but it's worth looking into. I can't imagine what situation is so competitive that on week of lost Figma design/React building/or learning something new so so catastrophic so as not to be permitted. Perhaps I'm misreading and the activity is so boring but required that carrying on computing is better--I've certainly done that.

The only time I would be very annoyed by such responses is if that's all the responses I got. Some of both is reasonable: perhaps I did pose an XY problem.

> The 'do something else' is the community caring. Perhaps it's incorrect

If the community cared, wouldn’t they answer the question instead of ignoring the question that was asked?

The community didn't ignore the question, see the other replies. I said that it would be annoying if these types of replies were all I received. And my other post does give a suggestion.
I agree. Sure, maybe I will soak in the nature but I'm not going to do that 24/7 for a week. Some days I might just want to program in said nature while sitting outside.
This is a classic example of the xy problem https://xyproblem.info/, where the author is asking for advice on his solution (how to study react on a vacation without internet), when for the vast majority of circumstances the best advice for the author would be to not waste his vacation studying React.
You don't seem to understand what a conditional is.

_Given_ that I want to study React in the woods, how should I do it?

Whether or not to study React in the woods is completely irrelevant.

> You don't seem to understand what a conditional is; you'd have a hard time doing math or formal CS.

Ad hominems are against TOS.

Answering the question is irrelevant if it’s the wrong question to begin with. And for the wrong circumstances (ie if this is a family vacation) can be counter-productive. It’s far more productive to zoom out, ask why the author is asking for advice to study react on vacation, and address that instead. Consider this as you advance your career past recent college grad / swe1 :)

I'm sorry but I find your position and expressed attitudes to be patronizing. They are words I would expect from someone who's assumption is that they know better than the other people they talk to in life.

I've no idea what you meant by your reference to college grad / swe1 but it certainly didn't lessen the above-described impression.

Thats all fine and dandy for a site like StackOverflow, but we’re on HN here - there’s neither an obligation for commenters to write the comments you want to read, nor a guarantee your question will be understood the way you like.
I think eszed had a good point. I do appreciate the philosophy of taking in what you are doing in the situation rather than turning it into a code-fest. I have attempted that and failed. It just felt like forcing a situation that didn't work. Just take things as they come.

I also think that answers like this are one of many. Let people put in their 2 cents. I think it's great to have a variety of answers that approach the question differently.

I’ve also noticed that in threads about stack overflow people often complain that questions are answered with “do something else”.

And here, “do something else” seems a popular answer too. Perhaps it’s how we approach problem solving in general.

I think it's laziness: rather than solving a specific problem, it's much easier to pick from an infinity of other problems you can solve.
(comment deleted)
It’s because tech people are often fed XY problems.

https://en.wikipedia.org/wiki/XY_problem

The person asking the question is asking how to do something, instead of explaining what the problem is.

Without an explanation of what the problem actually is, you have to guess.

Solving XY problems without getting at the root issue can create endless amounts of needless effort for many people, which is why discussion and communication are so important.

A colleague of mine had to do this regularly when working on certain projects for the gov. It was an air-gapped environment. So no access to the internet.

This basically meant loading up a thumb drive of all the possible documentation he could get. You can use site archive tools to download an entire website's documentation. Depending on the complexity of what you want to build - you would also probably need to mirror a subset of your package manager i.e. npm mirror. Probably lots of eBooks, courses, tutorials. Nowadays maybe even a LLM might be a useful reference.

kinda weird they airgap but allowed thumb drives.

that would be very hard for me though, coding without internet. he must be really good at his craft haha.

The one place I know that is this secure, you hand the thumb-drives to security who scan them and verify the contents are of no risk before handing them back. The same on exit.
I’m surprised they allowed security to review the contents, and didn’t just allow the thumb drives to flow in a single direction
I'm surprised they're permitting thumb drives at all. External drives are common though, usually specifically cleared one. Every gov't office and gov't related contractor I've been involved with got the memo over a decade ago that thumb drives are not to be trusted. They go through and whitelist specific external drives and also permit bringing in (and usually shredding after) optical disks (CD or DVD). Optionally they use a "data diode" to bring data into the network.

https://en.wikipedia.org/wiki/Unidirectional_network

Don't. Sit outside and just exist for once :)
Better take reference guides of above mentioned technologies with you.
Coding in your local dev environment doesn't require internet.

localhost... right?

until you need a dependency…
You can download dependencies before you leave while you have internet...
There’s stuff like https://zealdocs.org/ that allow you to take all relevant documentation with you so offline coding will work.

If you just want to be productive, you could also bring a lot of books or downloaded tutorials on a drive.

Btw, make sure your drive is encrypted and you think of a way to backup your data so you don’t lose the offline progress.

Do any languages other than C provide decent man pages?
I wanted to say C++ but I noticed decent
cppreference is a great doc and can be download
True, I remember downloading it to my laptop before going to the South Pole.
Languages from the GNU project tend to have decent info pages (e.g. Guile, GCL, Libc). Perl also comes with perldoc, which is like manpages but instead of using the man command you use the perldoc command.
In python you can run help() on everything as I recently discovered.
I've always liked javadocs
>to make sure I'm productive over this time?

Is the purpose of the retreat to the middle of nowhere to be productive ?

Why do you think you need to make sure you're productive ?

If the purpose of your retreat is to be productive, maybe chose something that you can do without Internet, like programming in a language/framework you feel comfortable with, and just bring their documentation with you ?

If I were you, I'd make sure I have a local instance of f.ex Llama 2 and Code lama up and running.

Even though it's not as good as GPT-4, and might even be slower, the value you might get from a local modal in such a case will probably beat most other things. It will allow you to both look stuff up, and even learn new things without needing to copy large parts of potentially irrelevant information beforehand.

Not quite as long as a week but here are some tips when I want to code from a long haul flight or some other offline situation.

- The replacement for Figma is straightforward - pen and paper. Make sure you take some.

- devdocs.io for offline docs or if what you're using isn't in there, a lot of packages offer a PDF of their docs.

- I keep a pyproject file that has basically any mainstream package I am likely to want at any point while writing Python, then when I leave for a trip I make sure everything is installed locally. Docker can also be helpful for this.

- Sometimes I write tests when I have internet then when I'm offline I just spend the time making the tests go green.

- Other times I will forget about writing new code and learn something new by working through the PDF of a book. Most technical books set up the dev environment in the first few pages, do that when you have internet then you're good to go.

Other people have raised good points about getting away from your computer. I don't want to preach but I do like a 'holiday' day where I do some light coding in the morning then spend the afternoon doing something else entirely.

I tend to agree with the other commenters suggesting you just step away from the keyboard for a while. I've been programming for 40 years... it can be addictive, fun, and useful... but there are other and more important things in life. Focus on those.

If that advice falls on deaf ears, and you really do want to write code on your time off, then here are some suggestions. I was about to say 'welcome to how we used to code'... but there are differences, both positive and negative.

* Tools like `git` are invaluable to the extent they let you manage source code control offline. Use them if you don't already.

* Settle on your dependencies and frameworks while you have network access. Download all the source you can for future reading.

* Focus on algorithmic work.... places where it's more about thinking through the code you're writing rather than interfacing with something else. (Hard these days.)

* Buy and bring some books. There are still good programming books that can be useful. You won't be totally at the cutting edge with these, but you probably don't need to be either.

Agreed with the books advice (and the general advice of course.

More to the point though, op says “productive” and there’s more ways to be productive than doing grunt work. Bring books about things you want to learn or improve in your life, not necessarily code. See for example any of the books published by Stripe Press (https://press.stripe.com).

i would say dont.

unplug instead and consider it as a break.

youll just get disappointed once you encounter edge cases where you need more than the official documentation. i mean things that are hidden in github issues and stackoverflow posts.

it's okay to take a break anon, everythings gonna be okay.

Ignore all the know-it-alls here telling you that you shouldn't write code while you're on vacation. If any of them knew anything about being in nature they'd know that the morning and evening are the times with most wildlife activity, and hence there are plenty of hours for coding. And they'd also know that even those of us who actually spend time in nature regularly don't spend the entire day staring at the fucking trees! I'm with you, I write code because I love it, and I do it in nature. It's possible to code in nature and appreciate nature!
Can you elaborate what does “no internet” mean in this context?

Is there no way to go online for all duration of the trip?

Or is there some device that you can use occasionally to browse or perhaps even download something to an usb drive?

The only way to know what works for you is to try coding without internet, see what problem arises first and solve it as best you can.

Then see what problems arises next and solve that as best you can.

And so on.

Which means it will probably be a bit frustrating, involve a lot of small failures, and maybe even large failures.

But you will learn if you like to code without the internet and will try it again with better preparation or just liked the idea of being a person who codes without the internet but are not (which is ok).

Some people like to camp and some don’t.

Good luck.

Time to git clone the docs to all your tools. Mozilla MDN etc would be worth downloading. Make sure you have all your local infra like DBs running on your machine.

I did an hour of coding today disconnected from the internet and it was nice. Some things have to be put off but there is a surprising amount you can do!

Assuming you're fixed on not disconnecting:

I would recommend using ollama (or install llamacpp if you're on Windows) to bring along a modestly capable LLM you can run locally such a CodeLlama or Minstrel. They won't be as capable as ChatGPT, but a lot of knowledge gets compressed into these relatively small models.

I hope you are being sarcastic right?