Skip to content

Instantly share code, notes, and snippets.

@prozbik
prozbik / app.js
Created September 22, 2015 04:12
app.get('/:page?', function(req,res){
var page = req.params.page, data; //page = requrest(:page)
if(!page) page = 'home'; // page = home by default
data = storage[page];
if(!data) res.redirect('/') return;
data.links = Object.keys(store);
res.render('index', data);
})
var storage = {
var Nightmare = require('nightmare');
var fs = require('fs');
var getContent = function(i, data) {
var i = i || 0;
if(i < data.length) {
var n = new Nightmare()
.useragent("Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36")
.goto(data[i])
.wait()
@prozbik
prozbik / summation.js
Last active February 14, 2016 20:16
summation of all numbers from 1 up to x included
const summation = x => Number.isInteger(x) ? x * (x + 1)/2 : 'Invalid Value';