So far this summer is being much busier than usual.
A couple of weeks ago I attended the html 5 hack-a-thon organised by the Dublin GTUG guys. It was real fun and got to meet some very interesting people and to hack on a browser multi-user whiteboard based on WebSockets and canvas. All the projects were really good, and the effort during the two days paid off big time.
Last week we were busy working on a rails mountable engine to add feedback forms to your web during the Ruby Project nights at amworks. Only a few hours there but it's great to be able to learn and share socially out of work hours, at least from time to time!
In the meantime all is good to go for the code retreat we are organising for September the 17th. Location and sponsorship is pretty much all we needed, and we are looking forward to the day. Tickets flew in less than 3 days, so hopefully people will turn up on the day. If you are reading this, have a ticket, and know for sure that you cannot attend, please let us know cause we have a growing waiting list.
And finally, all is ready for the dublinjs meet up tonight in which Wiktor will tell us all about CoffeScript and Dom has prepared a Kata for us to go through. Great fun ahead!!!
Showing posts with label ruby. Show all posts
Showing posts with label ruby. Show all posts
Tuesday, August 16, 2011
the summer of busy
Labels:
coderetreat,
dublinjs,
javascript,
kata,
open source,
roman numerals,
ruby,
rubyireland
Friday, July 15, 2011
Sprockets for JavaScript
As a JavaScript newbie, a thing that some times puts me off when I see some libraries out there is the fact that they tend to be just the one big file, with long functions and tons of lines of code that is not that easy to follow.
Sprockets aim is to help out with this situation. As their website reads:
Sounds good to me!!! so how to get started? Reading the manual, of course!
The following is a quick a dirty guide to Sprockets and how to use it from the command line with the sprocketize command. I have created a really silly bunch of sample files that contain only dummy js functions and are here just to illustrate the use.
And you are ready to go!
What else you need to know? Only two more things are needed: directives and the sprocketize command.
Comments that start with the symbol above are considered directives, and they are used to pull in other resources that your project will use: other JavaScript files and any assets you use in the form of stylesheets, images, and so on.
There are two directives currently supported in Sprockets, require for other js files, and provide for other related assets. If the files are surrounded by quotes as in "myfile", then sprockets will only look for that file in the same directory. If is used, then all the load path will be searched for. That load path can be indicated to sprockets through the command line option.
So let's see some code: I have two files called my_file_1.js and my_file_2.js and I want them in just the one file for deployment. The contents of the files are:
my_file_1.js
my_file_2.js
The Sprocketize command
There are different ways to use Sprockets being probably the Ruby library the most used. But the gem also bundles a command line tool which is a wrapper for the Ruby library so let's go with that cause it is really easy.
From the previous section we have two files called my_file_1.js and my_file_2.js and I want them in just the one file for deployment. To generate that concatenated file we can do:
This will create a file called deployment_file.js with the following content:
deployment_file.js
You can see that firstFunction has been pulled in before the second one, and in the process all the comments and stuff that you don't need to deploy have also been stripped out. How nice is that!!!???
Hungry for more?
There is more about Sprockets that you can fin about in their manual. It is a great tool that I hope to start using soon.
Sprockets aim is to help out with this situation. As their website reads:
[Sprockets] helps you turn messy JavaScript into clean modules for development and a single file for deployment.
Sounds good to me!!! so how to get started? Reading the manual, of course!
The following is a quick a dirty guide to Sprockets and how to use it from the command line with the sprocketize command. I have created a really silly bunch of sample files that contain only dummy js functions and are here just to illustrate the use.
Installation
Installation is easy peasy through a Ruby gem. The only trick here is that if you are using rvm (and you should!) you will not need to use sudo, and if you are using your system Ruby it will probably be need. So let's do it:gem install sprocketsAnd you are ready to go!
What else you need to know? Only two more things are needed: directives and the sprocketize command.
Directives
//=Comments that start with the symbol above are considered directives, and they are used to pull in other resources that your project will use: other JavaScript files and any assets you use in the form of stylesheets, images, and so on.
There are two directives currently supported in Sprockets, require for other js files, and provide for other related assets. If the files are surrounded by quotes as in "myfile", then sprockets will only look for that file in the same directory. If
So let's see some code: I have two files called my_file_1.js and my_file_2.js and I want them in just the one file for deployment. The contents of the files are:
my_file_1.js
function firstFunction() {
// I do nothing really!!!
};my_file_2.js
//= require "my_file_1.js"
function secondFunction() {
// I do nothing but function one should appear before me
};The Sprocketize command
There are different ways to use Sprockets being probably the Ruby library the most used. But the gem also bundles a command line tool which is a wrapper for the Ruby library so let's go with that cause it is really easy.
From the previous section we have two files called my_file_1.js and my_file_2.js and I want them in just the one file for deployment. To generate that concatenated file we can do:
sprocketize *.js > deployment_file.jsThis will create a file called deployment_file.js with the following content:
deployment_file.js
function firstFunction() {
};
function secondFunction() {
};
You can see that firstFunction has been pulled in before the second one, and in the process all the comments and stuff that you don't need to deploy have also been stripped out. How nice is that!!!???
Hungry for more?
There is more about Sprockets that you can fin about in their manual. It is a great tool that I hope to start using soon.
Friday, June 17, 2011
learn, laugh and move on!
There's been a lot going on lately and as a professional procrastinator I couldn't let go the chance of putting off writing a new blog post, but with things going back to normal (hopefully!) it's about time for a bit of reflection.
It's been a very social few weeks, ending May with a double bill: The software craftsmanship conference in Bletchley Park, and a coding day with the chaps of codingday.org here in Dublin.
What can I say about scuk11? it was a great day with fantastic sessions and I got to meet a great bunch of Spaniards in red t-shirts. Happy faces all over... yeah, the bar was already open!
The Dublin event was also fantastic and although it was first thought as a coderetreat, the addition of scientists and their real problems changed the nature of the session itself and made of it a fantastic coding day. The group I was working with got a spinning cube in the browser, with three different lights and three particles lighting up the cube with different colours. Great fun using the Three.js library!
The month of June started with @silverspoon organising hack nights in a café near the city centre, that I sadly missed because I was in Barcelona for a conference. Spain was great, as usual, although it was raining most of the time, but that didn't really have an impact on things such as meeting old friends, the great conversations we had, and of course, the fantastic food!
On Tuesday the 14th we had the first meet up for the SICP study group at P2PU. You can see what happened in the new wiki. This is an open group which basically means that you can join in anytime that suits you. We will meet twice a week for the next couple of months, Tuesdays and Sundays at 7pm GMT, 3pm EST. We are hoping to finish a section every two weeks, including exercises. As chapter one of the book has 3 sections, we are hoping for a 6 week period to be done with it. Wish us luck!!! or even better, join in!!!
Last night the first Ruby Project Night happened in armworks. The space is absolutely great and I want to thank Alan for hosting it. We didn't really know what to expect at first, and after a bit of chat and trying to get the projector going, we started hacking away in a rails 3 gem, something that none of us had done before. We didn't get too far but at least we got it packing and installing fine. As soon as the @theirishpenguin pushes it publicly I will share the link here. It was great to meet a bunch of enthusiastic people and looking forward to meeting them again!
This morning I read this 'Help Wanted' message from @oisin in the ruby Ireland list. If you are looking for contract Ruby work you should definitely get in touch with him. His last talk at ruby Ireland was really interesting.
In the thread he mentions that they like egoless programming which brought me back to the this old post of mine. Weingberg's book is a very recommended read even if as myself, you were not even born when it was written!
An finally, more to look forward to as the first 'technical' meet up of the Javascript Dublin group will be next Tuesday 21st at 7pm. A presentation about jQuery for web apps and a kata with Jasmine are in the menu. Are you really going to miss that???
It's been a very social few weeks, ending May with a double bill: The software craftsmanship conference in Bletchley Park, and a coding day with the chaps of codingday.org here in Dublin.
What can I say about scuk11? it was a great day with fantastic sessions and I got to meet a great bunch of Spaniards in red t-shirts. Happy faces all over... yeah, the bar was already open!
The Dublin event was also fantastic and although it was first thought as a coderetreat, the addition of scientists and their real problems changed the nature of the session itself and made of it a fantastic coding day. The group I was working with got a spinning cube in the browser, with three different lights and three particles lighting up the cube with different colours. Great fun using the Three.js library!
The month of June started with @silverspoon organising hack nights in a café near the city centre, that I sadly missed because I was in Barcelona for a conference. Spain was great, as usual, although it was raining most of the time, but that didn't really have an impact on things such as meeting old friends, the great conversations we had, and of course, the fantastic food!
On Tuesday the 14th we had the first meet up for the SICP study group at P2PU. You can see what happened in the new wiki. This is an open group which basically means that you can join in anytime that suits you. We will meet twice a week for the next couple of months, Tuesdays and Sundays at 7pm GMT, 3pm EST. We are hoping to finish a section every two weeks, including exercises. As chapter one of the book has 3 sections, we are hoping for a 6 week period to be done with it. Wish us luck!!! or even better, join in!!!
Last night the first Ruby Project Night happened in armworks. The space is absolutely great and I want to thank Alan for hosting it. We didn't really know what to expect at first, and after a bit of chat and trying to get the projector going, we started hacking away in a rails 3 gem, something that none of us had done before. We didn't get too far but at least we got it packing and installing fine. As soon as the @theirishpenguin pushes it publicly I will share the link here. It was great to meet a bunch of enthusiastic people and looking forward to meeting them again!
This morning I read this 'Help Wanted' message from @oisin in the ruby Ireland list. If you are looking for contract Ruby work you should definitely get in touch with him. His last talk at ruby Ireland was really interesting.
In the thread he mentions that they like egoless programming which brought me back to the this old post of mine. Weingberg's book is a very recommended read even if as myself, you were not even born when it was written!
An finally, more to look forward to as the first 'technical' meet up of the Javascript Dublin group will be next Tuesday 21st at 7pm. A presentation about jQuery for web apps and a kata with Jasmine are in the menu. Are you really going to miss that???
Labels:
apprenticeship,
coderetreat,
deliberate practice,
development,
javascript,
kata,
open source,
p2pu,
programming,
psychology,
rails,
ruby,
SICP,
social learning,
study group
Monday, November 29, 2010
concise and expressive
This is the kind of stuff that amazes me about Ruby:
line = "/pop/mente_al_sol.mp3 | 3:45 | El niño gusano | Pon tu mente al Sol"
filename, length, artist, album = line.split(/\|/))
Isn't that just plain nice!?
Example adapted from the Programming Ruby, the pragmatic programmers guide.
line = "/pop/mente_al_sol.mp3 | 3:45 | El niño gusano | Pon tu mente al Sol"
filename, length, artist, album = line.split(/\|/))
Isn't that just plain nice!?
Example adapted from the Programming Ruby, the pragmatic programmers guide.
Tuesday, November 16, 2010
Ruby and Regular Expressions
I have decided for the nth time to learn Ruby, mainly because I've been playing with ruby on rails apps for years now, but I do not have the language essentials to go beyond the typical functionality covered in tutorials or project documentation.
So for starters, I am reading the pragmatic book on ruby 1.9 which by the way, is on offer for only $10 this week (don't know for how long, so hurry up!). The book is very readable and to the point, as most of the titles in the pragmatic bookshelf.
And although the language is definitely different for me, coming from a Java background, I got immediately hooked by one aspect of it which till now had been, to say the least, a bit scary to me; the use of regular expressions.
As a Java developer I had used regexp before, but in a very limited and focused way, which happened to be the creation of validation expressions for fields in GUIs. I am not implying that this is the only use case for regexps in Java, no no no, but personally, I had only used them in that context before.
It is nice to see how in Ruby they are such a used technique, and the book encourages you to use them from very early. As I said, I had been scared of regexp in the past. I had even bought a couple of books about them that I never got to read.
So today I went looking for some easy resources in the shape or short videos that I can watch during lunch, ant I came across this one, which happens to explain the subject quite well, and it's accompanied by a long-ish post and even a few more videos. All very interesting if you are into this kind of thing!
Subscribe to:
Comments (Atom)