Skip to content

Instantly share code, notes, and snippets.

View zergood's full-sized avatar

Ilya zergood

  • Yarosavl, Russia.
View GitHub Profile
package com.autocomple.textanalysis.matrices;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class DefaultCombinationMatrix implements CombinationMatrix {
@Override
public List<List<Boolean>> getMatrix(int size, int limit) {
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
package org.apache.lucene.util.automaton;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
package org.apache.lucene.util.automaton;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
package org.apache.lucene.util.automaton;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
trait Frontend {
this: Core =>
def config: Config
val log = LoggerFactory.getLogger(getClass)
def route(flow:Flow[HttpRequest, HttpResponse, Unit]): Route = {
path("dictionaries" / Segment / "suggestions"){ dictionaryId =>
get{
parameters("ngr"){ ngr =>
class MyServiceActor extends Actor with MyService {
// the HttpService trait defines only one abstract member, which
// connects the services environment to the enclosing actor or test
def actorRefFactory = context
// this actor only runs our route, but you could add
// other things here, like request stream processing
// or timeout handling
def receive = runRoute(myRoute)
@zergood
zergood / gist:53977efd500985a34ea1
Created May 27, 2015 11:26
Akka http sample for benchmarking
trait Core {
implicit val system: ActorSystem = ActorSystem("Suggestion")
implicit val materializer: ActorFlowMaterializer = ActorFlowMaterializer()
implicit val ec: ExecutionContext = system.dispatcher
}
object AkkaHttpStarter extends App{
val http = new VanilaHttp with Core{
override def config: Config = ConfigFactory.load()
}
@zergood
zergood / gist:e705cd6ce4cfec47c0a5
Created May 27, 2015 11:11
Quick and dirty load balancer
trait Frontend {
this: Core =>
def config: Config
val log = LoggerFactory.getLogger(getClass)
def route(flow:Flow[HttpRequest, Future[HttpResponse], Unit]): Route = {
path("dictionaries" / Segment / "suggestions"){ dictionaryId =>
get{
parameters("ngr"){ ngr =>
@zergood
zergood / Rails 4.0.0.beta1
Last active December 14, 2015 21:59
Working Gemfile example for Rails 4.0.0.beta1 app
source 'https://rubygems.org'
gem 'rails', '4.0.0.beta1'
gem 'sqlite3'
group :assets do
gem 'sass-rails', '~> 4.0.0.beta1'
gem 'coffee-rails', '~> 4.0.0.beta1'
gem 'uglifier', '>= 1.0.3'