 I've been working on a new version of what's going to be the next version of Revenius that lets you do actual concurrency. So this is basically a straight dig at Blake's Talks yesterday about Ruby not being very CPU concurrency. We've been spending a bunch of time on this and I want to just demo it for you really fast and I probably should have thought about that. Okay, so this is two minutes but the benchmarks take longer to run than that so we're only going to run sort of some of these on MRI because it's so fucking slow. Okay, so here we go. So this is a script right here. This is what the script looks like to slowly for your edification. It's just going to loop here. It's running this script that is called Gilwind 2. And we'll go look at that script in a second. So right now it's basically just doing a simple numerical algorithm for a large range of numbers, adding them all up and doing some very simple transform on them. And the idea is if you take that large range of numbers and you split it up between threads, do you get any, do you reduce the amount of runtime? So are you able to actually process individual chunks of this range independently? So on MRI right now you can see that it's basically negligible. This is the column we're looking at here folks. So you can see that by having more threads we're actually just fucking the system up. We're not doing, we're not getting anything out of it. It's just a total fail. So we'll just cancel that as you can see where I'm doing up to four threads. So there we did three threads and it didn't get us anything. So we're just going to forget that. So the current version of Rubinius, which is 101, I'm going to go ahead and I'll just let it scroll off the top. Okay. So we're going to run it again right now. And this is the 101 version of Rubinius doing the exact same workload. And this bar over here is the CPU meter. And I've also got this number right here. And you can see that we're for the most part only getting one CPU bar up at a time. And if you glance over here you'll see that we're only getting maybe up to 100% if we're lucky. Otherwise it's like 99 hovering around there. Is that really it? Okay. So while the other person comes up here you can see. All right. You should give them a 30 second warning. So I could have just jumped to the end. Sorry. I gave 10 because you were tight. But yes. Yes. All right. I got a brief moment. I just want to say everybody having a great time today. No, no. Come on. Can I hear you? Everyone having a good time? Everybody say a very special thank you to Josh, to Jim, to Leigh Ann, to all the other organizers. Thank you all very much for doing this. Come on everyone. Give them a hand. So I'm here to talk about Ticketmaster, which is about taking control of your ticket and project management systems, which, you know, they're kind of unruly. First of all, my name is Ron Evans, IKADed program. I'm with the hybrid group, we're a consultancy based out of Los Angeles. But here I'm here to talk about you guys. You're all different and our clients are all different. And they have a lot of different needs. But there's one thing that they all do, which is they somehow manage and control the projects that they're working on. Often they maybe are using your typical agile board, right? Pieces of paper, notepads, whatever. Some of them are using software like this well-known piece of software. Others, this, lighthouse. But the problem with your consultancy that has a lot of different clients is it turns out that a whole bunch of them are using every different system and ones you've never even heard of. What do you do about it? You're trapped. You have to use whatever they are using because they're the client and you're the consultant and they're paying the bill. So what do you do about this? Well, we created something called Ticketmaster, which is basically a universal API to ticket tracking and project management systems, kind of ties into the workflow thing we were talking about. Here's a very brief overlay of it similar to your database connectivity. You've got some providers that talk to the different back end ticketing and project management systems. You can talk to that through your application for our API through the command line interface. All right. Cool. Let's look at some code really fast. All right. So here's a very, very basic, simple one that is designed to open up the lighthouse provider and then iterate through all of the projects that are associated with your account and just dump them out the ID and the name. So pretty simple stuff. Let's look at something a little more different. You can set up a particular API key in a configuration file that's either per project or on your machine. I didn't do it per project because that way I switched to a client project. Everything's already set up for whatever project management or ticketing system they happen to be using. So here's another simple example. This one is using Pivotal and it's just opening up the last project in the list of projects and then iterating through all of the tickets saying the ID and the title. All right. Well, that's cool. Yeah, right. Okay. So now let's talk about something more interesting, which is I would like to take all of my Pivotal tickets and move them to lighthouse. All right. So we're going to open the Ticketmaster Pivotal and Lighthouse Providers, open the Pivotal project, a particular one, open the Lighthouse provider, create a new Lighthouse project. And then for each of the Pivotal tickets, go through and create a new Lighthouse ticket and then copy the comments in. All right. That's very cool. We want to do that migrating from one system to another. In fact, that's such a typical use case that we have made it with a copy, deep copy, which will copy automatically all of the information from one project to another because this kind of migration or synchronization is a very typical scenario. All right. So what can you do with all this? Well, we currently support Pivotal Tracker, Lighthouse, Basecamp, GitHub Issues, Unfuddle. People are working on JIRA, other back-end systems. It's very simple. You only need to derive from four different classes, the provider, the project ticket and comments and voila, you're speaking to your back-end system whenever it happens to be. And so we want you. That's right. You guys, because we need help. It's an open-source project. Try it out. See what happens. What's the worst that can happen? Help us fix it or just tell everyone about it. Come on. Start tweeting. The revolution will be Twittered and it's all about Ticketmaster. Thank you guys very much. For more info, go check out ticketrb.com and thanks. Thank you so much, Ron. You're a minute under. Nice. Next up, we've got Pete Ford in the Impossible Project. Am I on? Yes, I am. Hello. I'm Pete and I'm from Toronto. I'm from Canada and I'm from Unspace. Who's from Canada? Okay. So this is not a talk about Ruby. Who here? Put up your hands if you know what this is. Okay. So for the rest of you, I'm going to sex you out. Hold on while I focus on infinity. Let's go there. No megatrons over there. All right. So how was I just able to do that? Because you might have heard that the Polaroid Factory has all got shut down. Of course, there was a lot of dirty politics involved that most people probably didn't hear about. What actually is interesting is that at the closing of the factory in the Netherlands, this guy Florian Kapps, who's a personal hero of mine who similarly to I has been bit by the analog photography bug, he went and got drunk with these guys who were running the factory. They were careerist factory workers who put out Polaroid Film and they all got told to dismantle all their equipment. And this guy basically was able to get them drunk and thinking wildly about what would happen if they were able to maybe get a lease on the factory, reinvent some new film, hire all the dudes and relaunch it as a niche product. This of course speaks to me because if you were around me in Toronto during 2008, this is actually what I was pitching investors on at the time. So I'm a music fan and I always say that there's two types of bands that I love. There's bands that I wish I was in and there's bands that I'm glad they're doing it so that I don't have to. And moving to Netherlands and moving into a factory and restarting Polaroid production was something I was kind of willing to do but I'm really glad someone else did it for me. So basically this is a fascinating open source project. It's not software, it's film. These guys literally could not continue to make Polaroid film. It wasn't just a financial decision. That was a big factor in it but they ran out of the raw materials required to make the stuff. So basically they had to actually sit down and create from scratch an entirely new chemical process. They gave themselves a year. They almost hit the mark. I think they ended up launching in March of this year and the picture that I took just now is from the very first box of the very first batch of their first color film. It's developing in my pocket. Unfortunately it's still very beta. It's light sensitive. So I say that it's an open source project because they are handling it like an open source project. They are appealing to the hearts and minds of people who will pay expensive amounts for the film and test it because it's still very very unstable. So that means that if I don't keep this dry, if I don't put desiccant in a box and dry it out for about two weeks after I take the picture in a month, I won't actually be able to see you find folks that I took a picture of. But the thing is is that they're sort of embracing their faults and actively soliciting feedback and they're saying, listen, we have flaws. We're still working this out. But with your help we can all sort of reinvent this new analog film dynasty together. And I'm really sort of proud to be sort of a part of this. And I'm encouraging you all. You can get these cameras for under a hundred bucks on eBay. It's gorgeous. I mean look at the design of this thing. This is like an Apple design but like before Apple. And it's just so elegant that you can even get all this much awesome in one small convenient little pouch. And if this isn't sexy to you, I mean, hey that's cool. But if you've been noticing over the past couple of years there's been a lot of like SLR showing up at conferences. I'm not entirely sure what all of you all are taking pictures of but maybe next time bring one of these because you might actually have a lot of fun learning how to use light and you know catching the totally bizarre random moments and the weird chemical deficiencies of the film that they're pushing on us. It's all a lot of fun. And honestly if you end up hating this process just come back to me and I'll take whatever film you have left and refund you the money out of my pocket. Have a good day everybody. It's fun to say thanks to Leia because honestly Leia walks she's back there. I kind of is it inappropriate to ask for like a standing o? Next up David Stevenson on the fixture builder. Okay I talked last year about Sandbox and Groovy and today I'm here to talk about something actually more useful. I work at Pivotal Labs and we do a huge number of projects and about two or three years ago everybody in the Rails world was using fixtures and I think everyone here is probably familiar with why that was a terrible idea. The biggest problem that we encountered was they're totally unmaintainable and they're a hundred percent wrong almost immediately. The amount of work you have to spend to keep your fixtures up to date is just impossible to maintain in a system that has thousands of tests. But the real good thing about fixtures is that they were fast and they were really repeatable because the data was codified in these files and it didn't change unless you changed it. So then came factories and we have Factory Girl, we have Fix Jor, I'm sure there are others that I don't know about and I thought factories are really amazing until I had about a thousand tests using factories and then my test suite is like an hour long and I'm having to figure out how to paralyze it and I'm having to do things to make it go faster and so I learned that you can make it go faster. All you have to do is maybe not save your file and not save your records as much as possible, keep the number of objects down to a bare minimum but that sort of kept when against the principle that I could just throw together some factories and write tests but it did give me all these advantages, right? It was really easy and it was maintainable and it was flexible and it was always accurate because it used the models that I defined an active record to come up with the data. So it solved all the problems of fixtures but it brought its own problems and that it was too slow. So just to remind everybody, okay here's here's an example of a test written using using Factory. We're factoring up a product and doing some validation against it. It's kind of a naive test because we're creating like 10 objects in this before block here. This is just an example of how you could use factories maybe poorly to generate large amounts of data. This is guaranteed to get slow over time. If I were to write the same thing with fixtures, I would say at the top I'd replace that product with a particular product from my fixture file and this would go much faster. I wouldn't actually be saving any objects throughout my test so good news but I would have to maintain these things myself. So enter a fixture builder. We're going to use factories to generate fixtures. We're going to define a block of code. That block of code is going to generate large numbers of objects any number of objects we want and then at the end of the day that's going to be serialized. So block of code looks something like this. In the middle part of the screen here you can see we're defining a product maybe two products some variations of those products. As soon as that end is hit the state of the database is serialized or actually we run our test first and you can see it says building fixtures and builds products.yaml and variants.yaml. At the end of the day outcome the fixtures and fixture builder does some cool stuff like figuring out how to name your fixtures based on fields that it recognizes but getting back to this it also modifies looks at a particular sets of files for changes and decides when to be smart about rebuilding its fixtures. So we've brought this into several of our customers at Pivotal and we found that it's really easy if you start from the beginning but adding this to an existing project is very expensive you have to go through and normalize all of your tests. So the reason I'm preaching it to you today is if you add it at the beginning of your project you'll be much happier than if you have thousands of tests that are using factories and running extremely slowly and you didn't think of this. See if I have anything else. No thanks here's the GitHub URL. While David's changing over next up we've got Noah Gibbs who is getting rid of Java and who can't get behind that really. That's me. Okay so he's good enough to let me use his laptop since my 1-2-1 is not working. I work at onsite.com. We had about an eight-year-old legacy Java and JSP code base running on Tomcat and we switched over to JRuby for pretty much all of the new stuff for anybody who might want to do something similar or if you've got any friends that really need to kick their Java habit this is a little of how we've done that. So JRuby for those who aren't familiar is really really good for calling methods on Java objects from Ruby and just a very quick summary there. Is that code at all visible to anybody? No it's not the size. Yeah no it's the color. The colors. No that's not. All right. All right so I have like four minutes. You can import things directly you can create new Java objects you can call methods the way the method name conversions there works is visible. So chances are very good your Java code base is already written as if it were you know with models you've got objects that read from the database that do your validations that look an awful lot like active record models in terms of purpose. It would be really nice if you could switch to active record but in general that's going to be a harder sell because you're going to have to rewrite a lot of validation logic. However if you've got JRuby then it's still not at all visible. What you can do is you can write an active record wrapper that uses your existing tables your existing sequences not your existing logic but you can write wrapper functions around that that will call your Java that will do a that will wrap it in Ruby objects and as a result you can write your new views. So in addition to our existing JSPs we've added a whole bunch of new views and all of them what we do is we write them as regular Rails views except that our finders are basically Java. You wrap it in an active record instance like this and all of the validation logic is done in Java. You're writing through to the Java objects you're using finders from the Java objects we do it in a couple of different ways. The advantage doesn't actually end there because once you've done that you can take active record objects either these wrappers or other ones for your tables you can declare a Java interface use them there and you can essentially swap out the entire former Java object you can call through to Ruby from Java. I'm sorry can you speak up? Oh, good viewing. Sorry, do you want to do what? Okay. Sorry. Okay, so as a result you can basically swap out your large Java app piecemeal you can start with the views you can move on to writing supplemental models that exist alongside the Java models or you know new stuff that exists in addition to the Java models including using them where necessary from Java and that lets you go through and you can do the rewrite eventually you may not have to do it all you may want to do it all but for those of you who haven't looked into JRuby this is very much the the expected use case works really well we've had a really good luck with it I'd be happy to talk about the details to anybody. In general Rails is easier to write views in you get much better caching when you start switching to it for an active record and you'll have a much easier time selling it to the business people if you can do it piecemeal like this so look into it it's worth doing if you're trying to get rid of Java. Let's see how long do I have left? 13 seconds. Awesome. Well then you can also use Ruby for testing even if you're testing the Java stuff again look into JRuby it's awesome. Next up I'm on Gupta talking about perftools.rb. Hey guys my name is Amon I go by TMM1 on Twitter I did a talk called debugging Ruby at Lone Star a couple of weeks ago I'm just going to do a five-minute version of that talk. The talk is basically about debugging tools and tools you can use to figure out what's going on in your production systems and I'm going to focus on my favorite tool in the talk which is perftools. perftools is a CPU profiler that Google wrote and uses so there's a bunch of information on here about how to get up and running but the cool thing is basically it gives you a profile both in text format and in a nice visualization like you see on the right and the cool thing about this is you can just take a look and the boxes that are the biggest are the functions that are taking the most amount of time or the most amount of CPU cycles so it shows you what to focus on what to try to improve so I run this on my Ruby processes this is a C level profiler so it gives you information about what C functions are being called a lot which can still be pretty useful so this is something I ran in production on one of my Rails applications and it showed that the function RB store sub bang inside the VM was basically it was spending about 10 percent of its time in that function and I was able to trace that back to the timed out parse function and figured out that all these mysql day times were being parsed in Rubyland and eating up a lot of CPU so this was really useful and what I wanted was instead of seeing C level functions in this output to get Ruby level functions instead so I created a project called perftools.rb which is the Ruby equivalent of perftools again some information on how to use this but say you have this simple scenario application that has two routes one which is compute heavy so it computes the Fibonacci sequence for the first 10,000 numbers and one that's sleep heavy so it spends a lot of time but not necessarily on a CPU it's just called sleep so you can profile this and you'd end up with graphs like this so you can actually run perftools rb in two different modes CPU mode or real time mode so on the right you can see CPU mode and of course the compute action shows up at the top because it's using a lot of CPU cycles but if you run it in real time mode you see on the left sleep shows up at the top because even though it takes longer even though it's not using as much CPU so I've used this on a bunch of open source projects the reddit.rb the first couple versions use system timer and every single read and write that showed right away that there was a lot of overhead associated with that you can run this on ruby gems and see where it's spending a lot of its time it happens to be in file system access trying to figure out what directories and files exist I ran this on bundler recently and found out that a lot of time was being spent in gem version spaceship about 23 percent of time and so with a little a little bit of optimization micro optimization to that function we were able to increase the overall performance of bundle install that patch is going to be the next version of ruby gems I also recently added an object allocation mode and so you can just set this variable and basically instead of cpu cycles each box represents the number of objects that are allocated inside that function and so again this is on a production app and you can see that the date parse function was creating tons and tons of objects about 15 to 16 percent of all the objects created were being created in that function and so recently we're switching over to my skill too since that moves all the date parsing down to c and gets a bunch of objects as well as cpu overhead so I encourage all you guys to use this and the easiest way to do this is with a project called rack perf tools profiler and all you have to do is in your rails application you can pull in this piece of middleware and it just adds a bunch of urls that you can just start visiting to start profiling your application the easiest one is all you do is on any url add profile equals true and times equals some number and it'll run that action that many times produce a profile and in your browser spit out that gift right away so uh that's my talk uh there's a lot of other tools that I covered tools for linux like s trace and l trace tools for c like gdb tools for networks like t-speed dump and ngrab uh cpu usage stuff memory usage stuff and all these slides available on uh squib you can go to bitly slash debugging ruby awesome next up john woody woodell he's gonna talk about dubious okay so you can see that okay guys uh so i'm gonna tell you a little about dubious dubious is something that lets you basically mix in servlets into your rails app without having to get grossed up by writing much java code there's a project here called mira dubious and i tell you go bring down a bunch of stuff and run it right out of there there's no gems or even versions um and if you run it uh you know there's a little drawer here that opens up it's actually using jake where you're not prototype hopefully that's okay and it just tells you the versions that you're actually running there uh and so i have a little trip app here that i created and i you know want to create a little app here i can pick a date i'm gonna say go ruco i'm gonna say it's that date that's wrong date okay so um so i have that little app running locally and because it's running an app engine i can run this little a h thing and i can poke around my data it has a built-in data viewer if i want to modify the app for example i am going to control c out of here we do have a continuous integration thing running but it's a little bit tweaky so instead i'm going to go over to this guy here i'm going to go to here all right so i'm going to jump in here and grab a change you want to make i'm going to go to my model i want to put timestamps on it so i have some timestamps here that's basically what i need to do for my timestamps app models so there's my model you see i'm importing some java classes we're cloning can you see that all right how's that guys all right so i'm uh i'm cloning kind of like the data mapper style and importing any any class that i mentioned and then anywhere down here i can import that paste that piece of code that i copied so you notice i'm also creating something where i take a url from basically from google docs and convert it i also have this little hash that i wanted to put in there and if i want to look at that i can go into my apps views trips show so my urb template looks kind of like that now technically it's not urb because it's mirra but it looks all like urb that's kind of gross looking template but that's that's what you saw now i've just made a couple changes well i've made a change my model i'm gonna actually i'm actually going to compile it so what's happening there well it looks at that model that i had and it takes those properties and expands it out to a bunch of java method calls that i need in order for it to uh talk to java in fact it looks kind of like that it just generates a bunch of gross java now technically i don't have to look at that that's i can generate that if i want to see what's actually going on oh no it's done so if i go back to my script server i can see that it's running and if i go back over here now you might notice there's no timestamps on here i've got some attributes but no timestamps if i go back in to this and i am i running locally yeah i'm gonna go in here i'm going to just oops i need edit it i'm going to save it and then i should see in this other window here that now oops now i have uh entity types i should have this new timestamp created at that got created so i just recompiled it now how much time do i have one minute fifteen one that's enough time to publish it why don't i just go publish it with the heck so i'll go to this browser here i'm going to say go garu kodemo and i'm going to copy that i'm going to create it out and then i'm going to find my terminal again which is somewhere there i'm going to cut out of there i'm going to i'm going to edit my app config oops i'm going to tell it that in fact i want to be something called go god did i type that correctly guys go go garu go did i type that the same way yes fifteen seconds attention and oops oh four three two three go check it out it's published in a second great job woody thanks so very much next up is seth lab with smart browsers okay how's that my name is seth lad i work at google and i love ruby so i'm glad to be here we're going to start this with a little audience participation so the question i have for all of you is if you had to pick you know client approaches you today and you had to pick a mobile platform to develop for what platform would that be just yell it out iphone iphone a little bit android thank you okay good okay moving on uh so and why did why did that come right off the top of your head just yell it out like why why'd you pick that money what market share what it's good it's good okay so yeah great you know rich sdk yeah market share there's an app store people have them uh just a really great user experience right okay that makes that makes perfect sense here is from quarter one 2010 look at the market share 28% fry phone so you just said that i don't want to help 72% of potential users out there and yet you were totally okay with immediately saying iphone and thank you andra so uh i would like to say that i'm not exactly here to say that that's wrong i think that there's a lot of good reasons why we made that choice but you have to understand what you just said all right so i would like to say that that exact reasoning and logic should apply to how you approach web development and i think you should think about browsers as smart browsers just like you think about some phones as smart phones okay and for the reasons that you target smartphones should be the same reasons you should target smart browsers all right now and i think it's perfectly valid i want us to kind of flip the way we approach this why is this possible today of course html 5 tremendous amount of rich apis that are available to you for these smart browsers that give your users a very great rich user experience the type of user experience that you can monetize so some of the functionalities out there audio video obviously webgl for 3d speech to text text to speech file apis web workers desktop notifications canvas svg fonts geolocation device orientation all of this stuff is now becoming available on the rich web and in smart browsers you should target smart browsers this is your delivery platform okay let's look at some demos real quick first year device orientation available today and i just messed that up sorry about that okay this is just javascript listening to the device orientation apis present you know in in macbook this is on webkit so this is css with 3d transformations there is just a smidge of javascript here in this demo this is all css this runs on your ipad no other like complex javascript program anything this is just showing you what is possible with just using the facilities of html 5 and our smart browsers your users are going to love this moving on okay so the point here is target smart browsers first gracefully degrade okay so for example you don't have to like kill yourself trying to get rounded corners on ie6 just not worth it they can see square corners everything's going to be fine just use border radius move on okay so here's a great code that i love what would you have me do spend my time hacking around issues and older technologies like ie6 would you like me spend my time making the site look the best that it can on better desktop browsers as well iphone ipad touch ipad black grey and a host of other mobile devices this is the message we need to take to our clients they will understand it especially if you sell them on these are smart browsers okay so what about ie6 chrome frame is a plugin that you can install into ie678 that is your escape patch this is your this is your ticket out of the problem it essentially embeds chrome rendering engine into ie you just send a header or event attack great turns it on prompt your users to install this they know plugins they understand a plugin this is a plugin that solves your problem okay one more great demo this is indeed a ruby conference 15 this is ruby running in the browser using native clients this is possible today you don't have to use the only javascript although we love javascript check it out okay native client go get it ruby all right thanks so very much staff awesome next up is pat nakajima hello pat nakajima the name how many of you guys use cucumber okay how many of you guys love it and hate it okay cool um so i say screw cucumber nah just playing but not really um my twitter is nakajima my github is nakajima i work for a company called root me we do group text messaging which means that like cucumber kind of breaks down a lot of times um problem with cucumber are step definitions you basically have these you kind of default web rat you ones that work pretty well right um they don't only bother you but if you know about life you know things fall apart and especially we're gonna be working with text messages or just all sorts of things that are not like you know in the browser uh you get kind of things like this let me resize that uh can you see that given a group with the number four eight four blank uh when the group adds pat and the group adds damian with those phone numbers uh uh oh the problem there is basically group is an instance variable and when you use instance variables in your step definitions you're going to feel pain um so you can do something like this uh given a group with the number four eight four one two three then you can parameterize your steps and say you know put the the groups number in there every single time but that's getting so long that you can't even see the rest of that line so you parameterizing steps equals pain so no instance variables and no parameterizing you're tearing me apart cucumber the solution as we found it at ruby is to inline your step definition which basically means ripping out cucumber it looks like this uh given a group with that phone number under that we do that in comments we do all the features in comments and then under each comment we just write a little bit of capybara to or just you know code to you know express that in code um and really that should be readable enough anyway if you're writing your code properly it should just look like group dot ad pat group dot add damian things like this what about web steps you can use stake uh you don't have to use stake it's uh you can find it there on github but uh stake is basically just capybara okay um so then like people are like oh cucumber's still pretty awesome because of my business guys they can read it they can they can write it and what i say is uh you know they can still write the feature files you just turn that into comments then you write the code it's your job and you're good at it thanks a lot any questions two minutes flat oh question comments arguments awesome what up all right all right i'll talk to you later also if you don't get a chance to hear about blake's thing it's way cool round asking about it all right okay coming up next nathan eskenazi and thomas schaefer talking about terminator my name is nathan eskenazi and this is thomas and three days ago we created a gem that we thought solved a very simple problem earlier today you heard a lot of excellent review developers talking about their workflows and and so everyone has a different one but everyone has a workflow and so what this is about is automating a workflow making it a lot easier to start it up safari has to update and bam you have to restart your computer everybody loves the situation uh so after you're all set up you need to save this and somehow be able to get back to it quickly so the three points about the computer programmer are these three and we're here to tackle these two that's right impatient and laziness both very important virtues as a programmer and terminator helps to help you solve those very quickly when it comes to booting up your workflow for every single one of your projects on a per project basis that's right so it's actually really easy to set up it's about as straightforward as you can get you install terminator you type terminator create and you name it you name your workflow and then you can essentially define commands to act on the current directory or on any arbitrary directory essentially this is the exact same thing is just doing it manually except you just define it in a file this is yml but we have a full review version coming later using blocks and tabs yep so then you just terminator start yeah and i want to know right there it only shows tabs but we're actually in the middle of also releasing a feature for windows as well as arbitrary tab names that you can actually set right in the script file so there's actually very few commands here it's extremely straightforward you can create workflows you can start a workflow you can delete your workflows and you can get a list of all your workflows i also really wanted briefly to mention that i actually created this while i was working on i'm the creator of a framework called padrino and it's actually a synatra-based framework that gives you full stack support for a bunch of different rms and essentially creating whatever websites you want in a sort of alternative way to rails so i actually built this while i was working on padrino because i was forced to restart and i was like this is the last time i'm gonna have to set up my terminal like like my set of tabs so i was like all right i'm just gonna script this up and now i just have to terminator and it sets up automatically excellent thanks nathan and thomas next up is jim pulse with what is coffee script quick show of hands how many of you know coffee script is already okay okay what is coffee script answer nothing i wrote or even contributed to but it's something that's cool it's out there that i found that i think you guys will love so um so far this weekend here's what we've heard we've heard this guy say i find it kind of a pain to write javascript i'd rather write ruby heard this guy say most of us have two hammers in our toolbox ruby and javascript we've had this guy say i write almost as much code in shell as i do in ruby and javascript there's a theme here all of us aren't just ruby programmers we're ruby and javascript programmers and then you've heard this guy say rails 3.1 will serve your coffee script as you templates and some of you were probably like wait what is that so coffee script is kind of like scss or css or hamel for your html it's a wrapper language the little language compiles into javascript it wraps javascript in a nice pythonish rubyish syntax it's kind of really cool so let's take a look this is shamelessly lifted from coffee script.org verbatim i'd not write this even myself so to assign things it looks just like javascript you can do string interpolation in double quoted strings just like you can in ruby you can do interpolation in regexes too because you know we love doing interpolation in regexes awesome you can put if statements at the end of the line just like in ruby that's kind of cool functions just have parents are on the arguments and then a little arrow and then the body of the function notice no return statement it just returns the last value just like in ruby arrays look just like in javascript objects look just like in javascript but notice commas at the end of lines are optional notice parenz around function implications are optional you can do splats of arguments you can get all of your arguments slurped up into an array you can do a rick comprehension like in python there's an insistence operator that tells you if a variable exists and just to be clear about this this turns into the javascript that all of you hate to write because you write it so often if type of elvis is not equal equal undefined and and elvis not equal equal null then do that so it's pretty cool um q flame war how many of you like to simulate class based inheritance in javascript awesome um so it's got built in simulation of class based inheritance in javascript uh notice uh there's an at name this is like an instance variable that compiles into this dot name notice also this constructor function uh is has an empty body because constructor functions automatically apply all of their arguments that have at in front of them to the appropriate instance variables with this it's cool destructured assignment you can actually assign the return value from any art any uh expression to a complex data structure just like in ruby notice object literals the curly braces are optional how many of you hate writing dot bind this at the end of all of your inline function declarations so if you notice if you do this with a equals greater than instead of a dash greater than it does it for you that's pretty cool and that's all you can learn more at coffee script dot org again this is nothing i did but it's still really cool and yes there's all the tools you need to integrate into your variables it's awesome excellent thanks so much next up we've got shane becker it's his birthday doing better presentation slides i'm shane becker i got my vegan straight edge that's my user picture you've maybe seen me around i make websites for fun and profit this is uh the man that i work for i made the rubinia site i used to live in seattle and i was part of this thing i made that uh evidently i've recently started seattle or of yourself your slides are bad bad slides crash shuttles space shuttles i'm serious these are 10 things that will make your slides better i'll be pointing some fingers because i've had a little bit evidence the past day and a half use big text really big text as big as you can get away with and what helps you get to big text continuing abhi's idea this morning is no text well maybe not no text of course but less text seriously don't do bulleted lists your readers get ahead of your audience gets ahead of you they're focusing on what i'm not saying high contrast haven't used black on blue and it looked like this it was hard to read assume that that thing that's far away with the lights on is half as bright as this thing use use contrasty colors ruby doesn't scale we all know that so by transitive property slides about ruby don't scale so don't run your text all the way to the edge the two talks ago the really the two minute one was awesome real centered slides but his text went all the way to the edge and got cut off on the left otherwise it was totally red if you're at the movement of your content doesn't mean anything ryan davis don't move your content it's hard for me to follow but all these slides have been black text on white background that gets boring in the audience so mix that shit up a little bit maybe while you're talking about mailers they're all in red and then when you move to test they're all about red whatever you group them together also that was some alliteration humans are good at small tables not at big tables like use charts let's see if i could do this here see this right there we could see a pattern humans are good at visualizing patterns that we could see not in tables like i like helvetica i like it tightly current i like it bold i like it big i like it spaced out yahuda likes museo i love museo it's really great brian used comic seraph yesterday that's also a great typeface don't use these please definitely don't use that this conference has a big stage and a big screen that's the exception usually we have no stage and a little screen and when you're sitting behind evan or over in the corner here and looking through the podium you can't see text on the bottom so don't put text on the bottom rich kilmer and when you're presenting don't look up here at your slides especially if you're wearing a lapel mic because when you turn your head it turns it away from the mic and i can't hear you look at the audience not the screen and finally long live the snowman that was beautiful thanks i'm not the only design guy in here so if you're not a design guy find one of us and we'll help you with your slides maybe we could trade some work next up is uh misaligned mafoni which i've just missed horribly and i'm gonna ask him to say it the right way he's gonna talk about ruby then teaches ruby okay so um suppose you know who's uh why the luck is stiff uh last year on uh the night he disappeared i um decided to salvage the the guide from the internet our house and other people have salvaged his other work and we all republished it on github the same in the 24 hours of his disappearance so people decided to commemorate um the day of why they this year um and i promised to do something uh and i did i just didn't publish it it was um a little bit broken it was alpha it's still alpha but some people had convinced me to to to show it to you right now so my day i was doing this and it's too big okay um i wanted to teach ruby to people i couldn't reach uh this is not for you intermediate or experienced hackers this is for people who are trying to understand code that they're reading and uh i tried to make a parser for code actually i didn't write the parser but i used some existing projects to parse code and try to explain it to people so this is a ruby app written in sinatra that tries to explain some code here i have some code it's uh something that everybody of you understand what's going on except the line wrapping here ignore that um most of newcomers have need a long time to grok this right so what did i do first i hit explain down here this is my local instance so it's gonna take us to something a bit more ugly um i'm using ruby parser to generate um a tree of um you know this program um so i can better analyze its syntax i don't use regular expressions they're pain um and there is a project called ruby to ruby that deconstructs uh that uses this uh tree to reconstruct the ruby code back when i first heard of ruby to ruby project i thought you know like why would anybody parse ruby to generate ruby from that now i'm here using it i think it's very cool uh while i'm reconstructing this project this program i'm searching for specific things um sorry small searching for specific things and uh inserting uh special little comments in there then finally i have a couple of documents in markdown format that i insert into this code and i run it through i run it through um roco which is a documentation tool for a tool for for code so that we end up with something like this in two columns where on the right hand there's a ruby code on the left hand there is a documentation inserted inside the code so we see in the first line we have class definition and class inheritance the next line is method definition but it's also an init method so it's a class initializer it also has default argument values it also has a block block method argument here we see an instance variable then the super call then the setter method and um this is basically everything it's uh up on heroku on explain ruby dot net um i hope it will scale when everyone hits it at the same time it's a basic instance thank you um the reason i didn't publish it on my day because it still also has the same problems when the code is more complex it uh it you know generates some weird things here on the right side so if anybody can help with that this documentation files are just markdown plain text files which are up on github uh under my account explain ruby on github and you can contribute to those even if you don't want to mess up with the parsing of the language and those more experienced helped me mess up with the parsing of the language and you know let's make this something one really really awesome thank you miss law the only person to get a reverse heckle out of ryan davis next up elis chaffee let's go i haven't gone yet okay so um this also is a project like miss love that owes a debt to why and to ryan davis it too uses uh ruby parser and ruby to ruby in a novel way um it and it was also sort of got made made real uh for a whyday project um this is something uh oh and it also owes a debt to flip ph lip who i don't know if he's here because i don't know his real name um and uh okay here's here's the basic idea about wrong by the way everybody laughed at this nice cartoon someone is wrong on the internet um we all love tests right but apparently we hate asserts and the reason i know that is because nobody ever uses assert anymore they use assert equal or assert contains or assert whatever or they use should somebody basically assert was so maligned that some people went and invented an entirely new system of testing that they call bbd so they wouldn't have to use the word assert anymore and steve and i steve conover well raise your hand steve hi um decided to reclaim assert to revive assert because assert is great and we wanted to give to to break down all the walls that keep people from using assert these days right so i'm just going to step through a couple of the weird things the wrong things about the current way of asserting things inside of your tests so here's test unit this is a standard x unit format and by standard i mean it is completely wrong um you say normally when you want to assert that as something is equal to something else you put the equal between the things that you're asserting about and you say the actual thing before the expected thing that's actually one of the reasons people like our spec so much because the should reverses that reversal it puts it back into the natural order um in our spec so that work however there's a whole lot of other problems with this especially for novices the should is the the syntax is very confusing like what is should it's a method but it's a method on something weird actually an object which is totally bizarre if you're trying to teach that to somebody and you'll never have any idea for like the first six months you're using our spec where to put the spaces versus the dots versus the parennes versus the underscores um also this double equal thing it actually is not the equals method it is a weird it's sort of a made up method on this proxy that should returns that you have to call in and it does the matching so this isn't actually code this is some weird thing that's inserted on top of your code that kind of looks like code um mini test is getting closer because it sort of revived assert um however the failure message for assert in this case as it others is not helpful it just says sorry it failed and if you're lucky um you've passed trace to rate so you get to see the line number that it failed at um also if you want to make the message more clear you have to violate don't repeat yourself right if you look at this bottom line by the way I apologize to shame for the bullet points um assert time equals money well there's time should equal money which is useful but you've repeated time money and equals and then the should is obvious because of course you're in an assert so what do we do we turn assert back into something that can introspect the code that you are asserting about and so it actually looks inside of the block of code and makes a useful message out of the code that you already wrote so you don't have to write it again and by write it again I mean not just in a string but write it again by using one of these crazy I'll go over here one of these crazy methods there's dozens probably hundreds of methods in all these various test frameworks and the only reason that we have all these asserts 30 seconds is so the failure message comes out looking nice okay so how do we do it we cheat we use Ruby to Ruby but we open up the file on disk because we got the file in line number from the stack trace or from Ruby everybody grown okay thank you but the point is that this is not production code this is for use in tests okay so everybody I urge you to look at the read me and all the caveats that are out there and plus I just want to point out um that we have console color so you have no excuse not to use it I know that no framework without console color gets anywhere these days awesome thank you so much Alex okay so I have to ask for permission because we're now officially over time but I've got you who the cats and Blake Mizrani lined up to speak to you we think all right so you who don't want to tell you a little bit about client side cashing and I'm desperate to hear all right okay so as I said to Avi earlier your action pack and action controller are actually about HTTP plus responses right so here's a normal controller that you might get oh my god what's going on okay this is a normal controller that you might have in your application and you're rendering a template and you're getting the information from the database so let's say you have this situation and you want to have it be cashed using htp caching based on the last time that this was modified I'm going to walk through how you might do that manually in a rails application we're going to get to not doing it manually soon so the first thing that you have to do is you have to grab out the if modified since headers from the request object and then parse that into a time right that's step number one step number two is you have two branches now right you have the uh what if if there is no last modified at all in which case that's just move on right nobody's asking for any caching otherwise render obviously these are two different branches that's why they look the same but they're going to be different the second the next step is if there isn't a last modified header make one and set it to be the htp date of the last time the post was modified right then in the else statement so now that top part is basically done right in the else statement we want to say if the post modified is bigger than the last time than the last modified from the browser basically do the same thing so i'm intentionally not being dry here but let's get dry so move that render out right and now we can combine those if else so if there isn't a last modified or if the post is modified since the last time the browser said things should be modified set this header up and then of course we need the case where the caching is happy right this is the case this is the case that we wrote the entire thing for so set the status code to 304 and return don't return uh don't render anything okay so this is what you have to do to do htp caching pretty much in every framework except for rails because nobody gives you any help other than this so this is it uh this actually works but let's actually start peeling it back to get to use things some of the rails facilities so first of all we don't actually have to get the header from the headers hash rails gives us if modified since if modified since also gives us back a date so that's good from the request object the next step is instead of setting the response that last modified header and doing that htp date weird thing we have to do we can just set it on the response object and you'll notice here i started from action controller metal which is basically raw rack and i pulled in now the rack delegation module uh the next step is it's kind of annoying to have to do if not not last modified or post modified is bigger than last modified so we can say if not modified post modified right the next thing that we do is that's annoying we don't want to have to now we're like doing some stuff on the response object let's just say pull in conditional get and we can say if this thing is stale and we can say last modified arrow post that updated at render and then the last thing is we'll pull in implicit render and now we can just say fresh when last modified points that post that updated at and now that does all the things that were on the slides before and then finally obviously i just showed that you can pull in some modules in the action controller metal but of course action controller base already has fresh one built in so basically the short version of all that is there's a bunch of stuff you have to do to htp caching right it's a good idea to do it almost nobody does it in the world it's not a very talked about thing because doing it is a big pain in the ass it's actually not that big of a pain in the ass in rails and people should do it more and uh as i said yesterday rails 31 will make give you a better reason to do it so all right thank you precision timing next up lake miss ronnie and i believe that we're going to talk about roundup roundup roundup everybody see that is it okay to the bottom it's a lot of no there you go that better and just make that all right did that work so you guys can see all this this is good okay so uh ryan was talking about is uh shell scripting talk about set dash e and uh i want to give you a quick show of that and uh what it can mean for testing command line interfaces so uh one of the things i do a lot of rogu i spend more time building family interfaces than i do building web interfaces anymore so um i needed a way to be able to test them uh really well so i here is a little shell script that just prints out the hostname but if you look at that it's a little more complex than that there's a set dash e in there what set that she does to tell you that instead of running through every single command it'll stop at the first one that uh exits with a non-zero status so you can see here that it should stop at false right so if i do uh there's also in shell you can do uh set dash x which will give you the trace output this tells you an execution the sub-shells that it's going into you can see what the plus signs the variable expansion and all of that you can see that it stopped at false right so i thought well shell is i think awesome at this so and this is a really really solid feature of shell i want to write a unit testing framework and i wrote it in shell and it's called roundup it looks like this uh when you run it you can see that the test that failed uh it actually prints out what at the line that actually failed and with the set dash x output um and it comes in turn style output the tests simply look like this if we do a roundup uh i'm going to test the five so this here i'm actually testing uh the thing so you can't have before's right you can have afters and you don't have to import anything or do anything you just run this file you just type it uh just all your tests start with it underscore right so we can say it passes here i'm saying true uh it fails so if i do a roundup uh and run the roundup five test you'll see that the failed one failed uh and let's scroll up here and you can see that the it fails failed on false right so uh i use this lot because when i'm testing command line interfaces uh or whenever i'm doing writing a lot of command line interfaces i went i was starting to write tests in ruby and using testing it and i realized that's f-ing stupid because i'm actually writing a command line interface so i should be testing it with the same language that i'm going to be using it with which is shell so i decided i'm and plus i also realized that when i'm doing it this way i wind up building better command line interfaces because it makes it easier to write tests with this thing so uh anyway that's it thanks and it's uh you can find it you can find it here be in this very roundup beautiful