Skip to content

Instantly share code, notes, and snippets.

View xnull's full-sized avatar
🦀
two bee or not two bee

Viacheslav xnull

🦀
two bee or not two bee
  • vmware
  • Cupertino
View GitHub Profile
class Main {
Tablitsa tabl = new Tablitsa();
int find(int i, int j){
return tabl.getRecord(i).getColumn(j);
}
}
class Tablitsa {
List<Record> records = new ArrayList<>();
class Main {
List<List<Integer>> tabl = new ArrayList<>();
void tablitso() {
add(tabl);
}
int find(int i, int j){
return tabl.get(i).get(j);
}
interface Create<K extends Key, V extends Value, Result> {
K key();
V value();
Result get();
}
interface CrudManager {
<K extends Key, R extends OperationResult<String>>
https://gist.github.com/n00neimp0rtant/9515611
package com.nd.ap.visit_metrics.controller
import cats.data.NonEmptyList
import cats.free.Free
import cats.implicits._
import cats.~>
import com.nd.ap.avro.visit_metrics._
import com.nd.ap.visit_metrics.controller.dsl._
import com.nd.ap.visit_metrics.controller.dsl.implementation.Sugar.FlatFrees
import com.nd.ap.visit_metrics.controller.dsl.implementation.Database._
package com.moex.eif.cantor.backoffice.calculator.settings
import java.io.File
import java.time.Instant
import com.moex.eif.cantor.backoffice.calculator.storage.PlatformEntityDataSource
import com.moex.eif.cantor.backoffice.model.GlobalSettings
import com.netflix.archaius.api.config.SettableConfig
import com.netflix.archaius.api.{ConfigLoader, PropertyContainer}
import com.netflix.archaius.config.DefaultSettableConfig
@xnull
xnull / OOPStyle.scala
Created September 28, 2016 08:41
OOPStyle scala
object MyApp extends App {
val dao = createDaoImpl()
val eventBus = createEventBus()
BusinessLogic(dao, eventBus).foo(123)
}
trait Dao {
def findById(id: Long): String
}
object Main extends App {
val a: Option[Int] = Some(1)
val b: Option[Int] = None
val c: Option[Int] = Some(2)
(a, b, c) match {
case (Some(x), None, Some(z)) =>
println("1")
case (Some(x), Some(y), None) =>
public static class Cacher {
private static final ConcurrentSkipListMap<CacherKey, Integer> cache = new ConcurrentSkipListMap<CacherKey, Integer>();
public void put(String key, Integer value) {
if (cache.size() >= 10) {
cache.pollLastEntry();
}
cache.put(new CacherKey(System.currentTimeMillis(), key), value);
}
@xnull
xnull / gist:21243a045360bb05de0b
Last active June 10, 2016 13:39
Scala example
package test
import test.common._
import scala.concurrent.Future
object Github extends Github(new HttpClient()) {
private val SearchApiUrl = "https://api.github.com/search/repositories"
}
class Github(httpClient: HttpClient) {