You can tell if mongoose is already connected or not by simply checking:
|
Tuesday, June 25, 2013
Check if Mongoose it's already conected
Monday, June 24, 2013
Error ! [rejected] master -> master (non-fast-forward) on Heroku/Git
$ git push origin master # To https://github.com/user/repo.git # ! [rejected] master -> master (non-fast-forward) # error: failed to push some refs to 'https://github.com/user/repo.git' # To prevent you from losing history, non-fast-forward updates were rejected # Merge the remote changes (e.g. 'git pull') before pushing again. See the # 'Note about fast-forwards' section of 'git push --help' for details.This error can be a bit overwhelming at first, do not fear.
Simply put,
git push -f https//github.com/user/repo.git
to force the upload.Tuesday, June 4, 2013
Mini Tutorial Node.js, Express, and Jade.
So
I'm leaving a small tutorial for not forgetting what i have done so
far...
Let's see first install everything we need:
>npm install express
>npm install jade
|
Now we have the pieces lest make the directory structure for this project, just add the directories "views" and "public" we will save the static things in public, like JavaScript and CSS files and jade views in views. Pretty obvious right...
Now
lets write some server code...
var app = express();
app.configure(function(){
app.set('port', process.env.PORT || 3000); //set the port
app.set('views', __dirname + '/views'); //set views dir
app.set('view engine', 'jade'); // set the template engine
app.use(express.favicon()); //set the favicon
app.use(express.static(path.join(__dirname, 'public'))); //set the public dir for static content
});
app.get('/', function(req, res){
res.render('index.jade', {title: 'Jade Example'}); //sends title to the template and renders it
});
app.listen(3000);
|
Let's
make some views...
First
the layout: layout.jade
!!! 5
html
head
title= title
link(rel='stylesheet', href='/css/bootstrap.css')
link(rel='stylesheet', href='/css/bootstrap-responsive.min.css')
body
header.site-header
a.logo(href='/', title='Express, Jade and Stylus') Express, Jade and Stylus
nav.site-nav
ul.nav
li.current
a(href='/', title='Home') Home
block content
p
| Created by
a(href='http://http://grimaldigerardo.blogspot.com.ar/') Gerardo Grimaldi
|
Then
a simple index: index.jade
extends layout
block content
h1 = title
p Welcome to #{title}
|
The
bootstrap css it's inside the public directory in:
'/public/css/bootstrap.css'
All
ready, let's take it for a spin...
node app.js
|
Bye
Subscribe to:
Posts (Atom)
The Video converter I needed
Handbrake it's an open-source video transcoder and a lifesaver! For people that don't have a lot of time for transcoding or don...
-
I was very busy with some configuration for a friend's blog on Blogger. She was paying a fee for the DNS redirect from her national DNS...
-
You can tell if mongoose is already connected or not by simply checking: if(mongoose . connection . readyState){ } 0 = no 1 = yes...
-
The other day I was trying to get a graphical novel from the web but the only format that I found was PDF. In some manner, I was sure it was...