Mocha is a unittest framework for Node. In this document, we explain how you can test your javascript code and also your HTTP servers.
Use npm to install Mocha:
npm install mocha| // the main app file | |
| import express from "express"; | |
| import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db) | |
| import authenticate from "./authentication"; // middleware for doing authentication | |
| import permit from "./authorization"; // middleware for checking if user's role is permitted to make request | |
| const app = express(), | |
| api = express.Router(); | |
| // first middleware will setup db connection |
| FROM node:0.12.7-wheezy | |
| # Install tools & libs to compile everything | |
| RUN apt-get update && apt-get install -y build-essential libssl-dev libreadline-dev wget && apt-get clean | |
| # Install imagemagick with support to native library | |
| RUN apt-get install -y imagemagick libmagick++-dev libmagic-dev && apt-get clean | |
| ENV PATH=$PATH:~/opt/bin:~/opt/node/bin:/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16 | |
| # Install global CLIs |
| // Returns the value at a given percentile in a sorted numeric array. | |
| // "Linear interpolation between closest ranks" method | |
| function percentile(arr, p) { | |
| if (arr.length === 0) return 0; | |
| if (typeof p !== 'number') throw new TypeError('p must be a number'); | |
| if (p <= 0) return arr[0]; | |
| if (p >= 1) return arr[arr.length - 1]; | |
| var index = (arr.length - 1) * p, | |
| lower = Math.floor(index), |
Mocha is a unittest framework for Node. In this document, we explain how you can test your javascript code and also your HTTP servers.
Use npm to install Mocha:
npm install mocha| Install Guide: | |
| 1. Download Rabbit MQ Server from | |
| https://www.rabbitmq.com/download.html | |
| 2. Install the RabbitMQ Server | |
| 3. Open Console (set environment variable or open RabbitMQ CMD) and run the following command | |
| rabbitmq-plugins enable rabbitmq_management |
The following snippets show some common Markdown mistakes.
Click the Raw button to see the source text and understand the author's intent.
GitHub's parser handles some of these cases; other parsers do not.
To catch these problems automatically:
| (function( $ ) { | |
| $.fn.photoswipe = function(options){ | |
| var galleries = [], | |
| _options = options; | |
| var init = function($this){ | |
| galleries = []; | |
| $this.each(function(i, gallery){ | |
| galleries.push({ | |
| id: i, |
| var express = require('express'), | |
| app = express(); | |
| app.listen(80); | |
| app.get('/', function(req, res){ | |
| var ua = req.header('user-agent'); | |
| // Check the user-agent string to identyfy the device. | |
| if(/mobile|iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile|ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(ua)) { | |
| res.sendfile(__dirname + '/mobile.html'); | |
| } else { | |
| res.sendfile(__dirname + '/index.html'); |
| package springbatch; | |
| import common.Greeting; | |
| import org.springframework.batch.core.Job; | |
| import org.springframework.batch.core.Step; | |
| import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; | |
| import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; | |
| import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; | |
| import org.springframework.batch.core.launch.JobLauncher; | |
| import org.springframework.batch.core.launch.support.SimpleJobLauncher; |
sudo yum update
##Install Redis https://gist.github.com/dstroot/2776679
wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
chmod 777 install-redis.sh
./install-redis.sh