- First-class functions
- Implicit parameters / conversions
- Pattern matching, case classes
- Type inference
- Higher-kinded types (abstraction over type constructors)
- Monadic for comprehensions
- Variance annotations
- Interfaces with behavior (traits)
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
// ... | |
val connection = factory.newConnection() | |
changeInnerPriority(connection, | |
config.get[Int]("tq.connectionPriority").getOrElse(Thread.NORM_PRIORITY)) | |
// ... | |
def changeInnerPriority(connection: com.rabbitmq.client.Connection, | |
priority: Int): Unit = { | |
def getHostAddressAsString: String = { | |
connection.getAddress.getHostAddress |
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
<?php | |
/* Pass in by reference! */ | |
function graph_amo_rabbit_prod_report ( &$rrdtool_graph ) { | |
global $context, | |
$hostname, | |
$mem_shared_color, | |
$mem_cached_color, | |
$mem_buffered_color, |
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
config.vm.define :puppet do |app_config| | |
app_config.vm.customize ["modifyvm", :id, "--name", "puppet", "--memory", "512"] | |
app_config.vm.box = "precise_with_puppet" | |
app_config.hosts.name = 'puppet' | |
app_config.vm.host_name = 'puppet' | |
app_config.vm.forward_port 22, 2222, :auto => true | |
app_config.vm.forward_port 80, 4561 | |
app_config.vm.network :hostonly, "33.13.13.01" | |
app_config.vm.provision :shell do |shell| | |
shell.path = "../puppet_master_setup.sh" |
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
abstract class Cake { | |
def top: String | |
def middle: String | |
def bottom: String | |
override def toString = top | |
} | |
trait Cherry { this: Cake => | |
def top = "cherry on top of " + middle | |
} |
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
# make sure this mode is enabled under administrator: Set-ExecutionPolicy RemoteSigned | |
# use a batch file like this: | |
# C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\Vbox\rabbits-headless.ps1 | |
$items = @( 'vagrant-rabbitmq-cluster_1351840619', 'vagrant-rabbitmq-cluster_1351840685', 'vagrant-rabbitmq-cluster_1351840745', 'vagrant-rabbitmq-cluster_1351840804' ) | |
Foreach ($item in $items) { | |
$p = '-s ' + $item | |
start-process 'C:\ProgramsX\Oracle\VirtualBox\VBoxHeadless.exe' $p -WindowStyle Hidden |
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
//From what I can tell the main things to tools to use are map, fold and lift. | |
//When you want to get something out of a validation regardless of | |
//whether it is a success or a failure | |
//(analogous to option's 'getOrElse') use fold: | |
class Example { | |
val s = 1.success[String] | |
// s: scalaz.Validation[String,Int] = Success(1) |
One of the goals of Play2 architecture is to provide a programming model for what is called Realtime Web Applications.
Realtime Web Applications are applications that make use of Websockets, Server Sent Events, Comet or other protocols offering/simulating an open socket between the browser and the server for continuous communication. Basically, these applications let users work with information as it is published - without having to periodically ping the service.
There are quite a few web frameworks that target the development of this type of application: but usually the solution is to simply provide an API that allows developers to push/receive messages from/to an open channel, something like:
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
using Umbraco.Core; | |
using Umbraco.Core.Services; | |
using Umbraco.Web.Mvc; | |
using Umbraco.Web.Routing; | |
namespace Our.Umbraco | |
{ | |
public class MyApplication : ApplicationEventHandler | |
{ | |
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) |
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 org.apache.hadoop.examples; | |
import java.io.IOException; | |
import java.util.StringTokenizer; | |
import org.apache.hadoop.conf.Configuration; | |
import org.apache.hadoop.fs.Path; | |
import org.apache.hadoop.io.IntWritable; | |
import org.apache.hadoop.io.Text; | |
import org.apache.hadoop.mapreduce.Job; |