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
package java8tests ; | |
import java.util.function.BiFunction ; | |
import java.util.function.Function ; | |
public class Currying { | |
public void currying() { | |
// Create a function that adds 2 integers | |
BiFunction<Integer,Integer,Integer> adder = ( a, b ) -> a + b ; |
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 fs = require('fs'); | |
var lame = require('lame'); | |
var Speaker = require('speaker'); | |
fs.createReadStream(process.argv[2]) | |
.pipe(new lame.Decoder()) | |
.on('format', function (format) { | |
this.pipe(new Speaker(format)); | |
}); |
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
#!/bin/bash | |
set -eu | |
shopt -s nullglob | |
if [[ -n ${RUN:-} ]]; then | |
dry= | |
else | |
dry=echo | |
fi |
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
package eri; | |
import scala.collection.Iterator; | |
import scala.collection.JavaConversions; | |
import scala.collection.Seq; | |
import scala.reflect.internal.util.BatchSourceFile; | |
import scala.reflect.io.AbstractFile; | |
import scala.runtime.AbstractFunction1; | |
import scala.runtime.BoxedUnit; | |
import scala.tools.nsc.GenericRunnerSettings; |
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
// Copyright 2004-present Facebook. All Rights Reserved. | |
/** | |
* Immutable data encourages pure functions (data-in, data-out) and lends itself | |
* to much simpler application development and enabling techniques from | |
* functional programming such as lazy evaluation. | |
* | |
* While designed to bring these powerful functional concepts to JavaScript, it | |
* presents an Object-Oriented API familiar to JavaScript engineers and closely | |
* mirroring that of Array, Map, and Set. It is easy and efficient to convert to |
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
from functools import wraps | |
from django.db import models | |
from django.core.exceptions import ValidationError | |
class ConstraintModel(models.Model): | |
class Meta: | |
abstract = True | |
def _fill_constraints_register(self): |
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
# node-supervisor: https://github.com/isaacs/node-supervisor | |
# locomotive: http://locomotivejs.org/ | |
supervisor --watch app/controllers,config,config/environments,config/initializers -- node_modules/locomotive/bin/lcm.js server |
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
@Retention(value = RetentionPolicy.RUNTIME) | |
@Import(HeloIBDR.class) | |
public @interface EnableHello { | |
String name(); | |
} |
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
// Index: | |
r.table("heroes").indexCreate("idEquipment", function(doc) { | |
return doc("equipment").map(function(equipment) { | |
return [doc("id"), equipment] | |
}) | |
}, {multi: true}).run(conn, callback) | |
// Query | |
r.table("heroes").getAll([1, "boots"], {index: "idEquipment"}).run(conn, callback) |
NewerOlder