node.js: boilerplating a site with express.js

Install express globally in your system, so you can use it from anywhere: $npm install -g express Initialize your installation: $express myapp; cd myapp; Modify your package.json file inside of there, and run it. Here’s a boilerplate example of it: { “name”: “nameofyourapphere”, “version”: “0.0.1”, “description”: “”, “main”: “index.js”, “scripts”: { “test”: “echo “Error: no […]

Rails: barebones site template from the ground up, version II, using rails 4

Assuming you have rails 4 already running in your system. And git / heroku also ready to go. $ rails new your-project Add a bunch of static pages, remove the default page: remove public/index.html (if there) $ rails generate controller StaticPages home help about contact_us –no-test-framework Inside config/routes.rb” – Comment out the static pages you […]

Rails: Active Record callbacks

There are simple filter-like, provided methods (aspect oriented style), to deal with the life and death cycles of models, the most common are: before_create after_create before_save after_save before_destroy after_destroy If for any reason, the method returns false, the chain of events will stop, for instance: def before_create ¬†¬†false end will effectively stop any model creation. […]