Skip to content

Instantly share code, notes, and snippets.

View nightscape's full-sized avatar

Martin Mauch nightscape

  • Regensburg, Germany
  • 23:25 (UTC +02:00)
View GitHub Profile
{
"metadata" : {
"name" : "ClasspathTest",
"user_save_timestamp" : "1970-01-01T01:00:00.000Z",
"auto_save_timestamp" : "1970-01-01T01:00:00.000Z",
"language_info" : {
"name" : "scala",
"file_extension" : "scala",
"codemirror_mode" : "text/x-scala"
},
@nightscape
nightscape / Plot graph with D3.snb
Last active December 4, 2015 12:47
Graphical exploration of Bayesian Networks in Spark Notebook
{
"metadata" : {
"name" : "Plot graph with D3",
"user_save_timestamp" : "2014-12-15T00:55:09.510Z",
"auto_save_timestamp" : "2014-12-15T00:50:41.883Z",
"language_info" : {
"name" : "scala",
"file_extension" : "scala",
"codemirror_mode" : "text/x-scala"
},
@nightscape
nightscape / Main.scala
Last active January 22, 2018 17:36 — forked from anonymous/Main.scala
Scala.jsFiddle gist
import com.google.appsscript.adwords._
import com.google.appsscript.base.Logger
import com.google.appsscript.spreadsheet._
/**
* This is an example app for Apps Scaripped using Google Spreadsheet
*/
object AppsScarippedMain extends js.JSApp{
def main(): Unit = {
val adsIterator = AdWordsApp.ads()
@nightscape
nightscape / AppsScarippedMain.scala
Last active October 19, 2016 11:02
Scala.jsFiddle gist
import com.google.appsscript.adwords._
import com.google.appsscript.base.Logger
import com.google.appsscript.spreadsheet._
/**
* This is an example app for Apps Scaripped using Google Spreadsheet
*/
object AppsScarippedMain extends js.JSApp{
def main(): Unit = {
val adsIterator = AdWordsApp.ads()
@nightscape
nightscape / HingeQuadraticOptimization.scala
Created May 16, 2015 08:32
Breeze Hinge Quadratic Optimization as described in http://www.stat.colostate.edu/~meyer/hingerev2.pdf, ported from R
import breeze.linalg._
import breeze.numerics._
import scala.annotation.tailrec
/**
* quadratic programming code: hinge algorithm
* find theta to minimize t(theta) * qmat * theta - 2* theta * cvec
* subject to amat * theta >= 0
*
* qmat must be positive definite, amat must be irredicible
*
@nightscape
nightscape / usr_share_X11_xkb_compat_misc
Created January 3, 2016 02:23
Tweaked NEO keyboard layout for Linux with working CTRL+SHIFT+Mod4Navigation
default partial xkb_compatibility "misc" {
virtual_modifiers Alt,Meta,Super,Hyper,ScrollLock;
// Interpretations for some other useful keys.
interpret Terminate_Server {
action = Terminate();
};
@nightscape
nightscape / LiftAllZipping.scala
Created May 19, 2016 21:36
Trying to apply shapeless LiftAll instances to an HList
import shapeless._
import ops.hlist.LiftAll
import shapeless._
import syntax.singleton._
import shapeless.ops.hlist.ZipWithKeys
case class SingletonOf[T, U](value: U)
object SingletonOf {
implicit def mkSingletonOf[T <: AnyRef](implicit t: T): SingletonOf[T, t.type] = SingletonOf(t)
@nightscape
nightscape / Example.java
Created October 21, 2016 19:59
Simple RxJava-based adapter for an Android RecyclerView
public class ReactiveTextViewHolder<T> extends ReactiveViewHolder<T> {
private TextView label;
private T currentItem;
public ReactiveTextViewHolder(View itemView) {
super(itemView);
label = (TextView) itemView.findViewById(android.R.id.text1);
}
package shiplis
import shapeless._, poly._, ops.hlist._
object MapWith
{
object Apply
extends Poly2
{
implicit def c[A, B, R, Tail <: HList, F <: Poly2]
@nightscape
nightscape / error.log
Created December 30, 2016 02:10
Scala meta macro with annotation and arguments
[error] java.lang.IllegalArgumentException: wrong number of arguments
[error] @unapply[BlockStmt](Array("getStmts", "getComment", "getOrphanComments")) object BlockStmtCompanion
[error] ^
[error] one error found