Instantly share code, notes, and snippets.

# Matiasmatiasa18

• Sort options
Created Sep 25, 2015
View solution.rb
 require "minitest/autorun" # Solution for # 1.Given an array of n integers where _n > 1_, `nums`, return an array `output` such that `output[i]` # is equal to the product of all the elements of nums except `nums[i]`. # # Solve it **without division** and leave a comment with the time complexity of your algorithm. # # For example, given `[1,2,3,4]`, return `[24,12,8,6]`. def problem_1 (nums)
Created Dec 27, 2013
View gist:8152730
 var fs = require('fs'), required_files = []; module.exports = function(app) { recursive_require(__dirname, __dirname, app); function recursive_require(directory, base_dir, app) { fs.readdirSync(directory).forEach(function (input) { var next_directory = directory + '\\' + input + '\\';
Created Dec 17, 2013
View gist:8008133
 var passport = require('passport'), Category = require('../../../models/category'), messages = require('../../../modules/messages'); module.exports = function(app) { app.get('/admin/categories/add', function(req, res) { Category.find(function(err, categories) { if (err) throw err; res.render('admin/categories/form', {title: 'Add Category', category: new Category(), path: '/admin/categories/add', categories: categories, edit: false});
Created Dec 17, 2013
View gist:8007867
 var mongoose = require('mongoose'), auto_increment = require('mongoose-auto-increment'); var category_schema = new mongoose.Schema({ name: {required: true, type: String}, categories: [{ name: {required: true, type: String}}], parent_id: Number }); category_schema.plugin(auto_increment.plugin, 'Category');
Last active Dec 31, 2015