Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View japgolly's full-sized avatar
☠️
Non-existant

David Barri japgolly

☠️
Non-existant
View GitHub Profile
@zraffer
zraffer / package.scala
Last active April 26, 2017 11:17
a few operations with functors
package object types {
import scala.language.reflectiveCalls
import scala.language.higherKinds
// quantifiers aka (co)ends
type Forall[+F[_]] = { def apply[X]: F[X] }
type Exists[+F[_]] = F[_]
// basic categorical notions
@djspiewak
djspiewak / streams-tutorial.md
Created March 22, 2015 19:55
Introduction to scalaz-stream

Introduction to scalaz-stream

Every application ever written can be viewed as some sort of transformation on data. Data can come from different sources, such as a network or a file or user input or the Large Hadron Collider. It can come from many sources all at once to be merged and aggregated in interesting ways, and it can be produced into many different output sinks, such as a network or files or graphical user interfaces. You might produce your output all at once, as a big data dump at the end of the world (right before your program shuts down), or you might produce it more incrementally. Every application fits into this model.

The scalaz-stream project is an attempt to make it easy to construct, test and scale programs that fit within this model (which is to say, everything). It does this by providing an abstraction around a "stream" of data, which is really just this notion of some number of data being sequentially pulled out of some unspecified data source. On top of this abstraction, sca

@Mzk-Levi
Mzk-Levi / ncompositions.scala
Last active March 24, 2018 03:06
Horizontal & Vertical Compositions of Natural Transformations
trait Functor[F[_]] {
def map[A, B](as: F[A])(f: A => B): F[B]
}
object Functor {
def apply[F[_]](implicit e: Functor[F]): Functor[F] = e
}
trait ~>[F[_], G[_]] {
def apply[A](x: F[A]): G[A]
@staltz
staltz / introrx.md
Last active April 20, 2024 14:15
The introduction to Reactive Programming you've been missing
@arosien
arosien / runar-io-free.scala
Last active September 10, 2016 07:17
Translation of Runar's ScalaIO 2013 presentation on IO and Free monads (http://blog.higher-order.com/assets/scalaio.pdf) to scalaz.
import scalaz._
import Scalaz._
import Free._
/** "Pure" interactions with a console. */
sealed trait Console[+A]
case class GetLine[A](k: String => A) extends Console[A]
case class PutLine[A](s: String, a: A) extends Console[A]
object Console {
@xian
xian / 00_README.md
Last active December 14, 2015 07:48 — forked from JakeWharton/ActionBarSherlockRobolectric.java
Here's the magic to get ActionBarSherlock working with Robolectric 2.0-alpha-2!

You need to add the files below, and do this once in your base test runner:

ActionBarSherlock.registerImplementation(ActionBarSherlockRobolectric.class);
ActionBarSherlock.unregisterImplementation(ActionBarSherlockNative.class);
ActionBarSherlock.unregisterImplementation(ActionBarSherlockCompat.class);
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 22, 2024 18:43
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@shangaslammi
shangaslammi / webspider.hs
Created October 4, 2011 08:25
Haskell Web Spider example
import Control.Exception
import Control.Monad
import Control.Monad.IO.Class
import Data.ByteString.Lazy (ByteString)
import Data.ByteString.Lazy.UTF8 (toString)
import Data.Function
import Data.Enumerator
import Data.List
import Data.Maybe
@hagenburger
hagenburger / javascript_loader.js
Created July 30, 2010 15:28
Dynamically load JavaScript files with callback when finished
// Example:
JavaScript.load("/javascripts/something.js");
// With callback (that’s the good thing):
JavaScript.load("http://www.someawesomedomain.com/api.js", function() {
API.use(); // or whatever api.js provides ...
});