Skip to content

Instantly share code, notes, and snippets.

View mattpap's full-sized avatar

Mateusz Paprocki mattpap

  • Anaconda, Inc.
  • Wrocław, Poland
View GitHub Profile
@mjarosie
mjarosie / hover.py
Last active November 2, 2019 19:10
Fix making https://github.com/bokeh/bokeh/pull/9153 build successfully
"""Example demonstrating hovering with line widths specified in the data source - with bokeh server"""
from bokeh.io import curdoc
from bokeh.plotting import figure
data = dict(
x=[0, 0, 25],
y=[5, 20, 5],
dw=[20, 20, 10],
dh=[10, 10, 25],
import numpy as np
import pandas as pd
from bokeh.models import Circle, ColumnDataSource, Range1d, HoverTool, CustomJS
from bokeh.transform import factor_cmap
from bokeh.plotting import figure, show, output_file
output_file("hover_linked_samples.html")
raw_array=np.random.rand(80,2)
@ktoso
ktoso / output.bash
Last active June 12, 2016 17:20
An proof of concept implementation to Adam's "what if we just used the types" blog post http://www.warski.org/blog/2013/01/dry-parameter-names/
ktoso@moon /Users/ktoso
$ scalac vals_by_types.scala
warning: there were 2 deprecation warnings; re-run with -deprecation for details
one warning found
ktoso@moon /Users/ktoso
$ scala Main
The combined names are: UserFinder and UserStatusReader
@retronym
retronym / type-bounds.scala
Created December 16, 2009 11:17
Tour of Scala Type Bounds
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
@retronym
retronym / generalised-type-constraints.scala
Created November 8, 2009 08:02
Demo of generalised type constraints in Scala 2.8
// scala 2.7 simple type constraint. This can only constrain a type parameter of this function.
// Below, in ListW.sumint28, we can't use this approach because we want to constrain T,
// a type param of the enclosing trait.
def sumint27A[T <: Int](l: List[T]) : Int = l.reduceLeft((a: Int, b: Int) => a + b)
trait IntLike[X] extends (X => Int)
object IntLike {
implicit val intIntLike: IntLike[Int] = new IntLike[Int] { def apply(x: Int) = identity(x) }
}