Skip to content

Instantly share code, notes, and snippets.

Daniel Spiewak djspiewak

Block or report user

Report or block djspiewak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View diamond-typeclasses.scala
// ...get it?
final case class InductT[F[_], A](run: F[A])
// assume InductT is defined in some upstream library, so it knows nothing of the following
trait Functor[F[_]]
object Functor {
implicit def inductTFunctor[F[_]: Functor]: Functor[InductT[F, ?]] = new Functor[InductT[F, ?]]
View welp.txt
~/Development/slamdata λ javap -cp $(coursier fetch -p org.specs2:specs2-core_2.12:4.3.6) 'org.specs2.specification.dsl.mutable.ExampleDsl0$BlockExample0'
Compiled from "ExampleDsl.scala"
public class org.specs2.specification.dsl.mutable.ExampleDsl0$BlockExample0 {
public final org.specs2.specification.dsl.mutable.ExampleDsl0 $outer;
public org.specs2.specification.core.Fragment $greater$greater(scala.Function0<org.specs2.specification.core.Fragment>);
public org.specs2.specification.core.Fragments $greater$greater(scala.Function0<org.specs2.specification.core.Fragments>, org.specs2.control.ImplicitParameters$ImplicitParam1);
public <R> org.specs2.specification.core.Fragment $greater$greater(scala.Function0<R>, org.specs2.specification.core.AsExecution<R>);
public org.specs2.specification.core.Fragment should(scala.Function0<org.specs2.specification.core.Fragment>);
public org.specs2.specification.core.Fragments should(scala.Function0<org.specs2.specification.core.Fragments>, org.specs2.control.Im
View static_cast.scala
// we really want to vectorize something like this:
val bytes: Array[Byte] = ???
val results: Array[Byte] = new Array[Byte](bytes.length)
var i = 0
while (i < bytes.length) { // assume bytes.length % 4 == 0
results(i) |= bytes(i) & '"'
}
View thread.txt
java.lang.Thread.State: RUNNABLE
at sun.misc.Unsafe.unpark(Native Method)
at java.util.concurrent.locks.LockSupport.unpark(LockSupport.java:141)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.unparkSuccessor(AbstractQueuedSynchronizer.java:662)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1264)
at java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:457)
at java.util.concurrent.LinkedBlockingQueue.signalNotEmpty(LinkedBlockingQueue.java:176)
at java.util.concurrent.LinkedBlockingQueue.offer(LinkedBlockingQueue.java:430)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1371)
at scala.concurrent.impl.ExecutionContextImpl.execute(ExecutionContextImpl.scala:20)
View runAsync.txt
"nioEventLoopGroup-2-31" #137 prio=10 os_prio=0 tid=0x00007f3a74022000 nid=0x2d15 runnable [0x00007f3a708f3000]
java.lang.Thread.State: RUNNABLE
at sun.misc.Unsafe.unpark(Native Method)
at java.util.concurrent.ForkJoinPool.signalWork(ForkJoinPool.java:1649)
at java.util.concurrent.ForkJoinPool.externalPush(ForkJoinPool.java:2414)
at java.util.concurrent.ForkJoinPool.execute(ForkJoinPool.java:2630)
at scala.concurrent.impl.ExecutionContextImpl$$anon$3.execute(ExecutionContextImpl.scala:131)
at scala.concurrent.impl.ExecutionContextImpl.execute(ExecutionContextImpl.scala:20)
at cats.effect.internals.IOShift$$anon$1.apply(IOShift.scala:28)
at cats.effect.internals.IOShift$$anon$1.apply(IOShift.scala:26)
View Preferences.sublime-settings
{
"added_words":
[
"memoized",
"Effectful",
"refactor",
"subqueries",
"backends",
"metadata",
"offline"
View error.txt
[info] Loading settings for project global-plugins from watch.sbt ...
[info] Loading global plugins from /Users/daniel/.sbt/1.0/plugins
[info] Updating ProjectRef(uri("file:/Users/daniel/.sbt/1.0/plugins/"), "global-plugins")...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang#scala-library;2.12.7: configuration not found in org.scala-lang#scala-library;2.12.7: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scala-lang.modules#scala-xml_2.12;1.0.6 compile
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
View SlicePlate.scala
/*
* Copyright 2014–2018 SlamData Inc.
*
* 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
View mra-worksheet.rb
# MRA - Multidimensional Relational Algebra
1 + 2 # => 3
-1 # => -1
s = [1, 2, 3]
t = [4, 5, 6]
-s # => [-1, -2, -3]
s + 3 # => [4, 5, 6]
View setByMod.java
/**
* Ensures that all disjoint index mod rings contain at least one
* set bit. If a disjoint index mod ring *already* contains a set
* bit, then its contents are guaranteed to be left unmodified.
* More rigorously, the first invariant is captured by:
*
* ∀ i . ∃ j >= 0 && j < mod . bits(i + j) == 1
*/
public void setByMod(int mod) {
if (mod >= 64) {
You can’t perform that action at this time.