Skip to content

Instantly share code, notes, and snippets.

View navarroaxel's full-sized avatar

Axel Navarro navarroaxel

View GitHub Profile
@navarroaxel
navarroaxel / bower.json
Created May 1, 2014 17:20
Example of bower config file
{
"name": "myweb",
"version": "0.0.1",
"dependencies": {
"jquery": "~1.8.0"
}
}
@navarroaxel
navarroaxel / npminstallbower.sh
Created May 1, 2014 17:21
Install bower using npm
npm install -g bower
@navarroaxel
navarroaxel / npminstallbower-installer.sh
Created May 1, 2014 17:21
Install bower-installer using npm
npm install -g bower-installer
@navarroaxel
navarroaxel / bowerinstallangular.sh
Created May 1, 2014 17:23
Install AngularJS using bower
bower install angular --save
@navarroaxel
navarroaxel / bowerinstallangular-mocks.sh
Created May 1, 2014 17:23
Install Angular-Mocks using bower
bower install angular-mocks --save-dev
@navarroaxel
navarroaxel / arrayExtensions.js
Created May 2, 2014 15:12
Array extensions in JavaScript
Array.prototype.where = function (query) {
if (!query) {
return this;
}
if (typeof(query) == 'function') {
return this.filter(query);
};
return this.filter(function (e) {
@navarroaxel
navarroaxel / _example.js
Created May 2, 2014 15:32
Basic Example for underscore use in JavaScript
// Option A
var threes = _.map([1, 2, 3], function(num){ return num * 3; });
// threes => [3, 6, 9]
var odds = _.filter(threes, function(num) { return num % 2 != 0; });
// oddss => [3, 9]
// Option B
var odds = _.filter(_.map([1, 2, 3], function(num){ return num * 3; }), function(num) { return num % 2 != 0; });
@navarroaxel
navarroaxel / _pluck.js
Created May 2, 2014 15:38
Example of pluck using UnderscoreJS
var stooges = [{name: 'moe', age: 40}, {name: 'larry', age: 50}, {name: 'curly', age: 60}];
var names = _.pluck(stooges, 'name');
// names => ["moe", "larry", "curly"]
@navarroaxel
navarroaxel / express.sh
Created May 11, 2014 20:12
Install Express and example app
npm install -g express
npm install -g express-generator
express nodeapps
cd nodeapps
npm install
npm start
@navarroaxel
navarroaxel / index.js
Last active August 29, 2015 14:01
Home route in node.js
var router = require('express').Router();
/* GET home page. */
router.get('/', function(req, res) {
res.render('index', { title: 'Express' });
});
module.exports = router;