Skip to content

Instantly share code, notes, and snippets.

View ramontristani's full-sized avatar

Ramon E. Tristani ramontristani

View GitHub Profile
<script>document.write('<script src="http://' + (location.host || '${1:localhost}').split(':')[0] + ':${2:35729}/livereload.js?snipver=1"></' + 'script>')</script>
@ramontristani
ramontristani / avatar.perl
Last active September 9, 2015 02:03 — forked from tommeier/avatar.perl
Run Gource over your git repo
#!/usr/bin/perl
#fetch Gravatars
use strict;
use warnings;
use LWP::Simple;
use Digest::MD5 qw(md5_hex);
my $size = 90;
@ramontristani
ramontristani / gh-repos-rest-url
Created February 25, 2014 07:06
User repos rest URL
https://api.github.com/users/[USER_NAME]/repos
@ramontristani
ramontristani / routes-root
Created February 25, 2014 06:18
Routes root module
Router = function(app) {
return {
Home: require('./home')(app)
};
};
module.exports = Router;
@ramontristani
ramontristani / home-routes
Last active August 29, 2015 13:56
Express middleware home routes module
Router = function(app) {
var homeOptions = {
title: 'Node.js',
subtitle: 'Web Application Development',
description: 'An introduction to web application development with Node.js'
};
app.get('/', function(req, res) {
console.log('Request rendered');
res.render('index', homeOptions);
@ramontristani
ramontristani / express-app-config
Last active August 29, 2015 13:56
Express application configuration
module.exports = function(express, path, app) {
var root = path.normalize(__dirname + '../../../');
app.configure(function() {
app.use(express.logger('dev')); // log all requests to the console
app.use(express.cookieParser()); // enable reading of cookies
app.use(express.json({ limit: '50mb' })); // set json request payload size
app.use(express.urlencoded({ limit: '50mb' })); // set query request payload size
app.use(express.static(path.join(root, 'public'))); // set relative site root
@ramontristani
ramontristani / package-json
Last active August 29, 2015 13:56
Basic package.json
{
"name": "nodejs-app-development",
"description": "An introduction to building web applications with Node.js",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app.js"
},
"dependencies": {
"path": "~0.4.9",
@ramontristani
ramontristani / app
Last active August 29, 2015 13:56
Basic Node.js app.js
var express = require('express'),
path = require('path'),
app = express();
require('./server/config/app-config')(express, path, app);
require('./server/routes')(app);
app.listen(process.env.port, function() {
console.log('Now listenting to requests');
});
@ramontristani
ramontristani / mit-os-license
Last active January 3, 2016 05:08
License: MIT Open Source license
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@ramontristani
ramontristani / .gitignore
Created January 14, 2014 04:51
Git: Git ignore file template
*private.js
*.old
node_modules/
.idea/