Skip to content

Instantly share code, notes, and snippets.

View dant3's full-sized avatar

Viacheslav Blinov dant3

View GitHub Profile
@dant3
dant3 / typedactordemo.scala
Last active August 28, 2015 15:38 — forked from rkuhn/typedactordemo.scala
TypedActor Demonstration
package typedactordemo
import akka.actor._
import akka.dispatch.Future
import akka.pattern.ask
import akka.util.Timeout
import akka.util.duration._
case class Request(payload: String)
case class Response(payload: String)
@dant3
dant3 / ListAdapter.scala
Created July 14, 2015 21:07
Lanterna 2 ListView & ListAdapter - a very simple version
trait ListAdapter[+T] extends Reactive {
def isEmpty:Boolean = size <= 0
def indexes:Range = 0 to maxIndex step 1
def maxIndex:Int = size - 1
def apply(index: Int):T = item(index)
def size:Int
def item(index: Int):T
def createItemString(index: Int): String
}
@dant3
dant3 / HelloLanterna3.scala
Last active December 19, 2017 16:17
Hello world, in Lanterna 3
import com.googlecode.lanterna.TextColor
import com.googlecode.lanterna.gui2._
import com.googlecode.lanterna.screen.Screen
import com.googlecode.lanterna.screen.TerminalScreen
import com.googlecode.lanterna.terminal.DefaultTerminalFactory
object Main {
def main(args:Array[String]) = {
val terminalFactory = new DefaultTerminalFactory
terminalFactory.setSuppressSwingTerminalFrame(true)
@dant3
dant3 / vlcsms.c
Last active August 29, 2015 14:22 — forked from TimSC/vlcsms.c
//To compile:
//cc vlcsms.c -o vlcsms -lvlc
//This source is by Tim Sheerman-Chase and it is released as public domain.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <vlc/vlc.h>
@dant3
dant3 / fun.cpp
Last active December 3, 2024 08:12
Some fun with C++ 11 - fold, map, reduce, mkString for std::vector<T>
#include <iostream>
#include <sstream>
#include <functional>
#include <vector>
template <typename T, typename U>
U foldLeft(const std::vector<T>& data,
const U& initialValue,
const std::function<U(U,T)>& foldFn) {
typedef typename std::vector<T>::const_iterator Iterator;
/**
* Copyright 2013 John Smith
*
* This file is part of Jewelsea Tic-Tac-Toe.
*
* Jewelsea Tic-Tac-Toe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@dant3
dant3 / vlcsms.c
Last active August 29, 2015 14:15 — forked from TimSC/vlcsms.c
//To compile:
//cc vlcsms.c -o vlcsms -lvlc
//This source is by Tim Sheerman-Chase and it is released as public domain.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <vlc/vlc.h>
#!/bin/bash
# prerequisites
apt-get install openjdk-7-jdk
NEXUS_DIR=/opt/nexus
mkdir -p $NEXUS_DIR
curl -L http://www.sonatype.org/downloads/nexus-latest-bundle.tar.gz | tar -xzv --strip 1 -C $NEXUS_DIR
@dant3
dant3 / build.sh
Created February 3, 2015 11:32
Ivy example
brew install ivy
ivy -retrieve "lib/[artifact].[ext]"
@dant3
dant3 / build.gradle
Last active December 23, 2015 09:07
lombok + gradle
apply plugin: 'java'
apply from: 'provided.gradle'
repositories {
mavenCentral()
}
dependencies {
provided group: 'org.projectlombok', name: 'lombok', version:'1.14.8'
}