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 we're using the right db; this is the same as "use aggdb;" in shell | |
db = db.getSiblingDB("aggdb"); | |
// simple projection | |
var p1 = db.runCommand( | |
{ aggregate : "article", pipeline : [ | |
{ $project : { | |
tags : 1, | |
pageViews : 1 | |
}} |
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
/* sample aggregate command queries */ | |
// make sure we're using the right db; this is the same as "use mydb;" in shell | |
db = db.getSisterDB("aggdb"); | |
// just passing through fields | |
var p1 = db.runCommand( | |
{ aggregate : "article", pipeline : [ | |
{ $project : { | |
tags : 1, | |
pageViews : 1 |
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
scala> import org.kiama.rewriting.Rewriter._ | |
import org.kiama.rewriting.Rewriter._ | |
scala> trait Expr | |
defined trait Expr | |
scala> case class Constant(x: Int) extends Expr | |
defined class Constant | |
scala> case class Add(e1: Expr, e2: Expr) extends Expr |
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
describe("自前のListを定義する"){ | |
object test { | |
abstract class MyList[+T] { | |
def isEmpty: Boolean | |
def head: T | |
def tail: MyList[T] | |
def ::[U>:T](item: U): MyList[U] | |
} | |
case class MyListImpl[T](val head: T, val tail: MyList[T]) extends MyList[T] { | |
def ::[U>:T](item: U): MyList[U] = new MyListImpl(item, this) |
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
host = db.serverStatus().host; | |
prompt = function() { | |
return db+"@"+host+"$ "; | |
} | |
// # simple-statistics | |
// | |
// A simple, literate statistics system. The code below uses the | |
// [Javascript module pattern](http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth), | |
// eventually assigning `simple-statistics` to `ss` in browsers or the |
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
find . \( -name *.scala \) -type f | xargs cat | wc -l |
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
ReVIEW::Compiler.defblock :reduce,0..1 | |
class ReVIEW::HTMLBuilder | |
def reduce(lines) | |
origin = lines.shift | |
puts %Q[<div class="table">] | |
puts %Q[<table class='table table-borderless'>] | |
lines.each_with_index do |line, index| | |
puts %Q[<tr>] | |
if(index == 0) | |
puts %Q[<td>] |
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
File Edit Options Buffers Tools Conf Help | |
# ndtpd | |
description "ndtpd" | |
author "Akimichi Tatsukawa <[email protected]>" | |
start on runlevel [2345] | |
stop on runlevel [06] | |
env DAEMON=/usr/sbin/ndtpd |
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
"use strict"; | |
const express = require('express'); | |
const app = express(); | |
const http = require('http').Server(app); | |
const io = require('socket.io')(http); | |
const flash = require('connect-flash'); | |
const bodyParser = require('body-parser'); | |
const methodOverride = require('method-override'); | |
const errorHandler = require('errorhandler'); |
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
# Logs | |
logs | |
*.log | |
npm-debug.log* | |
# Runtime data | |
pids | |
*.pid | |
*.seed | |
*.pid.lock |