This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function splat(fn) { | |
| return function(array) { | |
| return fn.apply(null, array); | |
| }; | |
| } | |
| var power = splat(Math.pow); | |
| console.log( power([2,8])); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var _ = require('underscore'); | |
| var niceAlert = _.wrap( console.log, function() { | |
| var args = _.toArray(arguments); | |
| var fn = _.first(args); | |
| var rest = _.rest(args); | |
| rest = _.map(rest, function(s) { | |
| if (s === 'f*ck') s = 'Well'; | |
| return s; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <blueprint | |
| xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" | |
| xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> | |
| <camelContext xmlns="http://camel.apache.org/schema/blueprint"> | |
| <route> | |
| <from uri="file:in" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const Hapi = require('hapi'); | |
| const server = new Hapi.Server(); | |
| server.connection({ | |
| host: 'localhost', | |
| port: 8000 | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "e746eec0-9bde-11e7-b0a1-194366ce7859" : { | |
| "id": "e746eec0-9bde-11e7-b0a1-194366ce7859", | |
| "title" : "Moby-Dick", | |
| "author" : "Herman Melville", | |
| "year" : 1851 | |
| }, | |
| "f1817e50-9bde-11e7-b0a1-194366ce7859" : { | |
| "id": "f1817e50-9bde-11e7-b0a1-194366ce7859", | |
| "title" : "Vingt mille lieues sous les mers", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO joke (joke) VALUES ('Jon Skeet does not have performance bottlenecks. He just makes the universe wait its turn.') | |
| INSERT INTO joke (joke) VALUES ('Users do not mark Jon Skeets answers as accepted. The universe accepts them out of a sense of truth and justice.') | |
| INSERT INTO joke (joke) VALUES ('Jon Skeet coded his last project entirely in Microsoft Paint, just for the challenge.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML> | |
| <html xmlns:th="http://www.thymeleaf.org"> | |
| <head> | |
| <title>Getting Started: Serving Web Content</title> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
| <link href="webjars/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" media="screen"/> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h1>The Jokes</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package de.predic8.reactiveweb; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| import org.springframework.web.reactive.config.EnableWebFlux; | |
| import org.springframework.web.reactive.config.WebFluxConfigurer; | |
| import org.springframework.web.reactive.function.server.RequestPredicates; | |
| import org.springframework.web.reactive.function.server.RouterFunction; | |
| import org.springframework.web.reactive.function.server.RouterFunctions; | |
| import org.springframework.web.reactive.function.server.ServerResponse; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) { | |
| ApplicationContext ctx = SpringApplication.run(ReactiveWebApplication.class, args); | |
| HttpHandler handler = WebHttpHandlerBuilder.applicationContext(ctx).build(); | |
| ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); | |
| HttpServer.create("localhost", 8080).newHandler(adapter).block(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <beans | |
| xmlns="http://www.springframework.org/schema/beans" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xmlns:spring="http://camel.apache.org/schema/spring" | |
| xsi:schemaLocation="http://www.springframework.org/schema/beans | |
| http://www.springframework.org/schema/beans/spring-beans.xsd | |
| http://camel.apache.org/schema/spring | |
| http://camel.apache.org/schema/spring/camel-spring.xsd"> | |
| <spring:camelContext> |
OlderNewer