This tutorial uses the "Sample hapi.js REST API" project.
Take a look at: https://github.com/agendor/sample-hapi-rest-api/
##Topics
- Introduction
- Installing Node.js
- Installing MySQL
- Setting-up the project
| # Sample implementation of quicksort and mergesort in ruby | |
| # Both algorithm sort in O(n * lg(n)) time | |
| # Quicksort works inplace, where mergesort works in a new array | |
| def quicksort(array, from=0, to=nil) | |
| if to == nil | |
| # Sort the whole array, by default | |
| to = array.count - 1 | |
| end |
| blog |
| <!doctype html> | |
| <html lang="en-GB" class="h-entry"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title class="p-name">Be more hapi</title> | |
| <meta name="HandheldFriendly" content="True"> | |
| <meta name="MobileOptimized" content="620"> | |
| <meta name="viewport" content="width=device-width"> |
| CREATE TABLE `payments` ( | |
| `id` INT(11) NOT NULL AUTO_INCREMENT, | |
| `amount` DECIMAL(8,2) NOT NULL, | |
| `date` DATE NOT NULL, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=INNODB DEFAULT CHARSET=utf8; | |
| INSERT INTO `payments` (`amount`,`date`) VALUES ('3.44','2012-01-01'); | |
| INSERT INTO `payments` (`amount`,`date`) VALUES ('344','2012-02-01'); | |
| INSERT INTO `payments` (`amount`,`date`) VALUES ('66.48','2012-03-01'); |
This tutorial uses the "Sample hapi.js REST API" project.
Take a look at: https://github.com/agendor/sample-hapi-rest-api/
##Topics
| function* fib(num) { | |
| var prev = 0; | |
| var curr = 1; | |
| while (curr < num) { | |
| var tmp = prev; | |
| prev = curr; | |
| curr = tmp + curr; | |
| yield curr; | |
| } | |
| } |
| /* | |
| Swap values using two index | |
| @param items {Array} | |
| @param firstIndex {Integer} | |
| @param secondIndex {Integer} | |
| @return 'undefined' | |
| */ | |
| var swap = function(items, firstIndex, secondIndex){ | |
| var temp = items[firstIndex]; | |
| items[firstIndex] = items[secondIndex]; |
| 'use strict'; | |
| var promiseCount = 0; | |
| function testPromise() { | |
| var thisPromiseCount = ++promiseCount; | |
| var log = document.getElementById('log'); | |
| log.insertAdjacentHTML('beforeend', thisPromiseCount + | |
| ') Started (<small>Sync code started</small>)<br/>'); | |
| // We make a new promise: we promise a numeric count of this promise, starting from 1 (after waiting 3s) | |
| var p1 = new Promise( | |
| // The resolver function is called with the ability to resolve or |