Connect arduino Yun to wifi like chromcast

I have been thinking about this for some time and have spent the last few weeks looking for any examples and haven't found much. I'm trying to connect my arduino Yun to a wifi network like a chromecast does. For those of you that haven't used a chromecast before.

Here is how it works.

The chromecast transmits a wifi signal. You connect to it and using your chromecast app you program in a new wifi and password. If the device loses the wifi it will then start to transmit again.

If you have seen anything similar to this I would love to see the code. I found some DIY chromecast that was based on a Yun but I couldn't find a coding for it.

Thank you in advanced!