∞ JS
RSS feed template for jekyll
If your blog is powered by the jekyll static site generator, you could use this template to create an RSS feed (thanks to Dave Coyle).
Edit this file with your data and save it in your site root as rss.xml.
Don’t forget to enable RSS autodiscovery by adding this line to the <head> section of your site:
<link rel="alternate" type="application/rss+xml" title="RSS Feed for mysite.com" href="/rss.xml" />
This will allow browsers and aggregators to automatically detect the RSS feed for your site. For example this is how it is rendered in Google Chrome:
Two ways to install Node.js on Ubuntu Linux
Today I installed node.js on my Linux machine. After installing it using the standard build process, I discovered nvm. Let’s see what are the steps needed for both ways.
The standard way - make
This will install the latest version of node.js.
Requirements
git, GNU toolchain
justb:~
⇒ sudo apt-get install git-core build-essential libssl-dev
Steps
First, clone the node git repo (I like to have all git repos I clone into a GitCloned folder, but you can choose whatever you like)
justb:~
⇒ cd GitCloned
justb:~/GitCloned
⇒ git clone git://github.com/joyent/node.git
Then place yourself in the cloned directory, and install with:
justb:~/GitCloned/node
⇒ ./configure && make && sudo make install
Analyze the terminal output to make sure everything went ok, then you can test your installation launching node from command line. This is the output I get:
justb:~
⇒ node
> console.log("Hello, world");
Hello, world
undefined
>
The modular way - nvm
Sometimes it’s useful to have more versions of the same software installed on the development machine. It’s good for testing and debugging and it let you try the bleeding edge without sacrificing stability.
nvm lets you install different versions of node.js and switch between each one with just one command (very much like rvm does for Ruby). So let’s install it.
Requirements
git, curl, GNU toolchain
justb:~
⇒ sudo apt-get install git-core curl build-essential libssl-dev
Steps
First, clone the nvm repository into a folder of your choice :
justb:~
⇒ cd GitCloned
justb:~/GitCloned
⇒ git clone git://github.com/creationix/nvm.git
Then you have to source it (you may want to add this line to your .bashrc, as stated in the docs):
justb:~
⇒ . ~/GitCloned/nvm/nvm.sh
justb:~
⇒ nvm
You should see this output
Then you can install the version of your choice. At this time of writing, the stable version is v0.6.19, but you could go as far as v0.7.9:
justb:~
⇒ nvm install v0.6.19
justb:~
⇒ nvm install v0.7.9
You could list all versions installed with:
justb:~
⇒ nvm ls
v0.6.19 v0.7.9
current: v0.7.9
and switch between them with:
justb:~
⇒ nvm use v0.6.19
Now using node v0.6.19
What now?
Well, now it’s the time to learn Node.js and write some cool applications! I’m just starting, but I will write what I’ll learn in these pages. Stay tuned.
How to save MySQL query results
It is often useful to save the result of a select statement into a text file. MySQL provides an easy mechanism for this task the SELECT ... INTO OUTFILE statement, which writes the selected rows to an external file.
The code is meant to be read
Often I read some code that I don’t understand. The majority of times is because I lack the information on the subject, but sometimes the code is just too terse to understand it at first read.
Read more »How to automatically reload Jekyll server?
When developing with Jekyll in local the server needs to be restarted after each change. Let’s see how to make it reload automatically.
Read more »