/examples

An open repository of Urbit examples.

Primary LanguageJavaScriptThe UnlicenseUnlicense

Urbit examples

Introduction

This is an open repository for Urbit example code.

There are generators (short :dojo commands), libraries (to be loaded into :dojo), web pages (built by %ford), applications (run by %gall), and marks and structures that these example %gall apps use.

The code is both here on Github and now on an Urbit ship (~dirbet-botweb). Now you can just merge the desk over the live network to get our examples and docs onto any of your live urbits. Give these a try by following the instructions below.

Installation

First, you'll need a running urbit on the live network. Follow our install instructions, then setup an urbit.

You're free to run these on a fake ship on a fake local network, but you won't be able to |sync over the live network. Instead, merge (create) an %examples desk manually from your %home desk, clone this repo and copy these examples into the %examples desk manually via Unix. More information on the Urbit filesystem here.

For development, using a disposable comet is usually a good idea, but none of these examples should sink your ship (if one does, please file an issue!), so you're free to use your planet.

On your live urbit, run the following one :dojo command to merge the %examples desk of our examples ship, ~dirbet-botweb, and stay synced to repo updates over the air:

~your-urbit:dojo> |sync %examples ~dirbet-botweb %examples

Upon a successful sync (usually about thirty seconds for the full merge to finish), you'll see this output:

sync succeeded from %examples on ~dirbet-botweb to %examples

Next, set your :dojo's current directory to your new %examples desk. Then |serve its web directory and mount the full desk to Unix. You can do all of that with the following three commands:

~your-urbit:dojo> =dir /=examples
~your-urbit:dojo/examples> |serve %/web
~your-urbit:dojo/examples> |mount %

If ~your-urbit was installed at /urbit/path on your Unix machine, you can now find your %examples desk at /urbit/path/your-urbit/examples.

And that's it!

Learn a lot, and have fun!

You're now free to play with these examples. Each example section has its own README page. They're in /web/examples of your %examples desk now; view the starting page in your browser at:

http://localhost:8443/~~/examples

The /~~/ in the URL will redirect you to Log In to your web interface so you can authenticate yourself and run your first examples smoothly.

We've found it also helps to have a clone of the docs on hand in case urbit.org experiences high traffic, so your new %examples desk contains those too. You can view them locally in your browser at:

http://localhost:8443/~~/docs

If you're running multiple ships locally, the port number will be different. Check your :dojo output for the correct local port, or view at https://your-urbit.urbit.org instead for live ships.

The number one goal for this repository is for it to be fun! People are always around on :talk and :fora. Help each other out, and don't hesitate if you have an idea for a contribution. We'd love to make this both a learning resource and a record of what people in the community are coming up with.

Contributing / Feedback

Give us feedback in the comments of this :fora post after you've played around with these for a little bit. Let us know about your ideas, requests, and/or problems and we'll try and get back to you quickly. Pull requests are more than welcome.


Happy hacking!