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
| #!/usr/bin/env groovy | |
| /** | |
| * Demonstrates how to use Grape to grab dependencies for | |
| * Groovy scripts. | |
| * | |
| * Grape stands for the Groovy Adaptable (Advanced) Packaging Engine, and it is a part of the Groovy installation. | |
| * Grape helps you download and cache external dependencies from within your script with a set of simple annotations. | |
| * | |
| * If, in your script, you require an external dependency, that you know is available in a public repository as Maven Central Repository, |
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 upload; | |
| import java.io.File; | |
| import java.io.IOException; | |
| import java.io.PrintWriter; | |
| import java.util.Iterator; | |
| import java.util.List; | |
| import javax.servlet.ServletConfig; | |
| import javax.servlet.ServletException; |
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
| <ivysettings> | |
| <settings defaultResolver="downloadGrapes"/> | |
| <resolvers> | |
| <chain name="downloadGrapes"> | |
| <filesystem name="cachedGrapes"> | |
| <ivy pattern="${user.home}/.groovy/grapes/[organisation]/[module]/ivy-[revision].xml"/> | |
| <artifact pattern="${user.home}/.groovy/grapes/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/> | |
| </filesystem> | |
| <!-- todo add 'endorsed groovy extensions' resolver here --> | |
| <ibiblio name="codehaus" root="http://repository.codehaus.org/" m2compatible="true"/> |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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
| /** | |
| * Encodes multi-byte Unicode string into utf-8 multiple single-byte characters | |
| * (BMP / basic multilingual plane only). | |
| * | |
| * Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars. | |
| * | |
| * Can be achieved in JavaScript by unescape(encodeURIComponent(str)), | |
| * but this approach may be useful in other languages. | |
| * | |
| * @param {string} unicodeString - Unicode string to be encoded as UTF-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
| /** | |
| * World's simplest express server | |
| * - used to serve index.html from /public | |
| */ | |
| var express = require('express'); | |
| var serveStatic = require('serve-static'); | |
| var app = express(); | |
| app.use(serveStatic(__dirname + '/public')); |