http://stackoverflow.com/questions/6084360/using-node-js-as-a-simple-web-server
You can use Connect and ServeStatic with NodeJS for this:
- Install connect and serve-static with NPM
$ npm install connect serve-static| module Api::V1 | |
| # Subclass from our normal api controller base class. | |
| class CrossSiteController < ApiController | |
| after_filter :cors_set_access_control_headers | |
| def route_options | |
| cors_preflight_check | |
| end |
http://stackoverflow.com/questions/6084360/using-node-js-as-a-simple-web-server
You can use Connect and ServeStatic with NodeJS for this:
$ npm install connect serve-static| var RendrBase = require('rendr/shared/base/collection'), | |
| _ = require('underscore'), | |
| syncer = require('../shared/syncer'); | |
| _.extend(RendrBase.prototype, syncer); | |
| module.exports = RendrBase.extend({}); |
| begin | |
| some_operation_here_that_may_throw_an_exception | |
| rescue | |
| puts $!.message | |
| end |
None of the current answers worked for me. I'm using Bootstrap 3.
I liked what Rob Vermeer was doing and started from his response.
For a fade in and then fade out effect, I just used wrote the following function and used jQuery:
Html on my page to add the alert(s) to:
| @import "vendor/mixins/for.less"; | |
| /* | |
| // https://github.com/seven-phases-max/less.curious/blob/master/src/for.less | |
| // ............................................................ | |
| // .for | |
| .for(@i, @n) {.-each(@i)} | |
| .for(@n) when (isnumber(@n)) {.for(1, @n)} | |
| .for(@i, @n) when not (@i = @n) { | |
| .for((@i + (@n - @i) / abs(@n - @i)), @n); |
Html
<ul class="list-csv">
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
LESS
Post from command line
curl -H "Content-Type:application/json" -H "Accept:application/json" -d "{\"commute\":{\"minutes\":0,
\"startTime\":\"Wed May 06 22:14:12 EDT 2009\",
\"locations\":[{\"latitude\":\"40.4220061\",
\"longitude\":\"40.4220061\"}, {\"latitude\": \"30\", \"longitude\":\"40\"}]}}" http://localhost:3000/test
In Rails
| function average (arr) | |
| { | |
| return _.reduce(arr, function(memo, num) | |
| { | |
| return memo + num; | |
| }, 0) / arr.length; | |
| } |
| // Class definition / constructor | |
| var Vehicle = (function() { | |
| /** @const */ var SPEED_LIMIT = 5; | |
| /** | |
| * A vehicle. | |
| * | |
| * @constructor | |
| * @this {Vehicle} |