This file contains 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
// --- cheat sheet --- | |
// | |
// Enumerator &> -> filters the output of the enumerator through an Enumeratee | |
// Enumerator >>> -> alias for andThen; adds the output of the second enumerator after the first one is done | |
// Enumerator |>> -> feeds the output of the enumerator into the given iteratee for processing | |
// --- end of cheat sheet --- | |
// Example | |
// Iteratee that sums up the size of the input: |
This file contains 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
/** | |
* This is small implementation of a tiny MVC-oriented framework inspired by the design | |
* of the Play Framework 2.0; it is meant as an educational exercise to get more familiar with | |
* the concepts of partial functions, function composition and generic types in Scala | |
* | |
* How to run: | |
* scalac framework.scala | |
* scala App | |
*/ |
This file contains 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
class A | |
class A2 extends A | |
class B | |
trait M[X] | |
// | |
// Upper Type Bound | |
// | |
def upperTypeBound[AA <: A](x: AA): A = x |
This file contains 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
trait Handler | |
class Handler1 extends Handler | |
class Handler2 extends Handler | |
trait HandlerConfiguration { | |
val handler1: Handler | |
val handler2: Handler | |
} |
This file contains 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 events = require('events'), | |
util = require('util'); | |
EventGenerator = function() { | |
events.EventEmitter.call(this); | |
this.read = function() { | |
var data = "this is new data"; | |
this.emit("data", data); | |
} |
This file contains 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
git config --global color.branch auto | |
git config --global color.diff auto | |
git config --global color.status auto |
This file contains 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 https = require('https'); | |
// https://www.yammer.com/api/v1/messages.json | |
var options = { | |
host: 'www.yammer.com', | |
path: '/api/v1/messages.json?access_token=YOUR-OAUTH2-TOKEN', | |
headers: { "Authorization": "Bearer YOUR-OAUTH2-TOKEN" } | |
} | |
var globalRequestId = 1; |
This file contains 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
Sub LangInFrames() | |
scount = ActivePresentation.Slides.Count | |
For j = 1 To scount | |
fcount = ActivePresentation.Slides(j).Shapes.Count | |
For k = 1 To fcount | |
If ActivePresentation.Slides(j).Shapes(k).HasTextFrame Then | |
ActivePresentation.Slides(j).Shapes(k).TextFrame.TextRange.LanguageID = msoLanguageIDEnglishUK | |
End If | |
Next k | |
Next j |
This file contains 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
* List of commits not pushed to origin yet: | |
git log origin/master..master |
This file contains 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
// | |
// How to start the embedded H2 web server in a Play Scala application | |
// | |
org.h2.tools.Server.startWebServer(play.api.db.DB.getConnection()(play.api.Play.current)) | |
// the browser should automatically open but if not, the correct URL is http://192.168.255.11:58024/ | |
// alternatively, this code only starts the web server (and the connection data must be manually provided). The | |
// correct port is 8082 |