(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.
| launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist | |
| sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist | |
| sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz | |
| sudo pkgutil --forget org.macosforge.xquartz.pkg | |
| # Log out and log in |
| package slick.lifted | |
| import scala.slick.driver.MySQLDriver.simple._ | |
| import slick._ | |
| object CaseClassMapping extends App { | |
| // the base query for the Users table | |
| val users = TableQuery[Users] |
| import scala.language.experimental.macros | |
| import scala.reflect.macros.blackbox.Context | |
| trait Mappable[T] { | |
| def toMap(t: T): Map[String, Any] | |
| def fromMap(map: Map[String, Any]): T | |
| } | |
| object Mappable { | |
| // Coproduct is extension of Either concept, to N multually exlusive choices | |
| type ISB = Int :+: String :+: Boolean :+: CNil | |
| val isb = Coproduct[ISB]("foo") //> isb : qaaz.ISB = foo | |
| isb.select[Int] //> res0: Option[Int] = None | |
| isb.select[String] //> res1: Option[String] = Some(foo) |
(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.
| // === Arrays | |
| var [a, b] = [1, 2]; | |
| console.log(a, b); | |
| //=> 1 2 | |
| // Use from functions, only select from pattern | |
| var foo = () => [1, 2, 3]; |
| //gulp & plugins | |
| var gulp = require('gulp'); | |
| var gutil = require('gulp-util'); | |
| var jshint = require('gulp-jshint'); | |
| var browserify = require('gulp-browserify'); | |
| var jade = require('gulp-jade'); | |
| var stylus = require('gulp-stylus'); | |
| var mocha = require('gulp-mocha'); | |
| var nodemon = require('gulp-nodemon'); | |
| var livereload = require('gulp-livereload'); |
| import scala.concurrent.{ExecutionContext, Future} | |
| import spray.routing.{AuthenticationFailedRejection, RequestContext} | |
| import spray.routing.authentication.{Authentication, ContextAuthenticator} | |
| /** Token based authentication for Spray Routing. | |
| * | |
| * Extracts an API key from the header or querystring and authenticates requests. | |
| * | |
| * TokenAuthenticator[T] takes arguments for the named header/query string containing the API key and | |
| * an authenticator that returns an Option[T]. If None is returned from the authenticator, the request |
| // Fonts mixin | |
| font-url(file) | |
| return '../fonts/' + file | |
| webfont(family, file, hack-chrome-windows = false, weight = 'normal') | |
| @font-face | |
| font-family family | |
| src url(font-url(file + '.eot')) | |
| src url(font-url(file + '.eot?#iefix')) format('embedded-opentype'), | |
| url(font-url(file + '.woff')) format('woff'), |
| import sbt._ | |
| import Keys._ | |
| import java.net._ | |
| import java.io.File | |
| import play.PlayRunHook | |
| /* | |
| Grunt runner should be in project directory to be picked up by sbt | |
| */ | |
| object Grunt { |