Skip to content

Instantly share code, notes, and snippets.

@bblfish
bblfish / akkaHttp.sc
Created Jul 10, 2017
attempt to get some linked data code working with akka http and streams
View akkaHttp.sc
import coursier.core.Authentication, coursier.MavenRepository
interp.repositories() ++= Seq(MavenRepository(
"http://bblfish.net/work/repo/snapshots/"
))
@
import scala.concurrent.ExecutionContext
View keygen generated certificate
$ openssl pkcs12 -clcerts -nokeys -in ~/Certificates.p12 | openssl x509
Enter Import Password:
MAC verified OK
-----BEGIN CERTIFICATE-----
MIIDITCCAgmgAwIBAgIGAUwZZ+oFMA0GCSqGSIb3DQEBBQUAMB0xDjAMBgNVBAMM
BVdlYklEMQswCQYDVQQKDAJ7fTAeFw0xNTAzMTQxNzM5NDJaFw0xOTAzMTMxNzQ5
NDJaMBwxGjAYBgNVBC4TEWhlbnJ5QGJibGZpc2gubmV0MIIBIDALBgkqhkiG9w0B
AQEDggEPADCCAQoCggEBANq50elB9vhaCGMWnQ22Mo0dShWnHf/j1PTQh1KlL7FF
TXNY5KXs81AeOSS8AlLzAEsLshoNa2TKBT8PvLWlTsk+vi3JuR5MQyuCeITEzCrY
oQK0bSogF79F2dTIilZNQgI0SEobLkRtu0zUOOecJGbOMQ8yd3OnedJO17YKBaYY
View ScalaReactSpeedTest.scala
package net.bblfish.test
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.ReactVDom._
import japgolly.scalajs.react.vdom.ReactVDom.all._
import net.bblfish.test.hlistaux.SelectNOrder
import org.scalajs.dom.{Node, document}
import shapeless.PolyDefns._
import shapeless._
import shapeless.ops.hlist.Mapper
@bblfish
bblfish / extractor.scala
Created Aug 13, 2014
This extractor works. It starts from a very simple base
View extractor.scala
package shapeless.examples
import shapeless.PolyDefns._
import shapeless._
import shapeless.ops.hlist.At
import scala.math.Ordering
/**
@bblfish
bblfish / ScalaJSExample.scala
Created Dec 25, 2013
A simple ajax call using scala-js
View ScalaJSExample.scala
package example
import scala.language.dynamics
import scala.scalajs.js
import js.Dynamic.{ global => g }
import org.scalajs.jquery.{jQuery => jQ, JQueryXHR, JQueryAjaxSettings}
//import scala.scalajs.js.{Dictionary, String, Any}
@bblfish
bblfish / CORSProxy.scala
Last active Dec 20, 2015
simple CORSProxy with Play2.2 - does not quite work. It blocks the HTTP connection, even though the URL is correctly fetched...
View CORSProxy.scala
/*
* Copyright 2012 Henry Story, http://bblfish.net/
*
* Licensed 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
@bblfish
bblfish / crashCompiler.scala
Last active Dec 11, 2015
This code crahes the scala 2.10.0 compiler on OSX with java "1.7.0_11"
View crashCompiler.scala
//Using library from "net.sf.uadetector" % "uadetector-resources" % "2012.12"
import net.sf.uadetector.service._
import net.sf.uadetector.UserAgentFamily._
import net.sf.uadetector.UserAgent
val agentParser = UADetectorServiceFactory.getResourceModuleParser
val UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.45 Safari/53.22"
val agent = agentParser.parse(UA)
@bblfish
bblfish / RequestHeader.scala
Created Sep 19, 2012
Claim Monad for X509 Certificates - having trouble running map on it
View RequestHeader.scala
import java.net.URI
import scalaz.concurrent.Promise
import scalaz._
import Scalaz._
import language.implicitConversions
import language.higherKinds
case class Cert(cn: String, pubKey: BigInt, webids: List[URI] )
trait RequestHeader {
@bblfish
bblfish / RequestHeader.scala
Created Sep 19, 2012
ClaimMondad version 1 - does not compile
View RequestHeader.scala
import java.net.URI
import scalaz.concurrent.Promise
import scalaz._
import Scalaz._
import language.implicitConversions
case class Cert(cn: String, pubKey: BigInt, webids: List[URI] )
trait RequestHeader {
View WebIDAuthN.scala
package org.w3.play.auth
import akka.actor.Actor
import org.openrdf.model.URI
import java.security.cert.X509Certificate
import org.w3.play.rdf.GraphCache
import scalaz._
import scala.Some
import scalaz.Scalaz._
import org.w3.banana.RDF
You can’t perform that action at this time.