Skip to content

Instantly share code, notes, and snippets.

💭
🕉 Coding...

Daniel Dietrich danieldietrich

💭
🕉 Coding...
Block or report user

Report or block danieldietrich

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 api-cheatsheet-array.md

Array<T>

Legend:

  • ✏️ method changes this.
  • 🔒 method does not change this.

Array<T>.prototype.*:

  • concat(...items: Array<T[] | T>): T[] 🔒 ES3
@danieldietrich
danieldietrich / dropdown.md
Created Apr 4, 2017 — forked from citrusui/dropdown.md
"Dropdowns" in Markdown
View dropdown.md
How do I dropdown? This is how you dropdown.
<details>
<summary>How do I dropdown?</summary>
This is how you dropdown.
</details>
@danieldietrich
danieldietrich / auto-deploy.md
Created Dec 13, 2016 — forked from domenic/auto-deploy.md
Auto-deploying built products to gh-pages with Travis
View auto-deploy.md

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

View codensity-tree.scala
sealed trait TreeLike[M[_]] {
def node[A](f: M[A], g: M[A]): M[A]
}
sealed trait Tree[+A] { self =>
def flatMap[B](f: A => Tree[B]): Tree[B] = self match {
case Leaf(a) => f(a)
case Node(l, r) => Node(l.flatMap(f), r.flatMap(f))
}
}
View Term.java
import static java.lang.System.*;
import java.util.function.BiFunction;
import java.util.function.Function;
// Implementation of a pseudo-GADT in Java, translating the examples from
// http://www.cs.ox.ac.uk/ralf.hinze/publications/With.pdf
// The technique presented below is, in fact, just an encoding of a normal Algebraic Data Type
// using a variation of the visitor pattern + the application of the Yoneda lemma to make it
// isomorphic to the targeted 'GADT'.
View DefaultMethodProxyExample.java
package labs;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
You can’t perform that action at this time.