Skip to content

Instantly share code, notes, and snippets.

David Barri japgolly

Block or report user

Report or block japgolly

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
hagenburger / javascript_loader.js
Created Jul 30, 2010
Dynamically load JavaScript files with callback when finished
View javascript_loader.js
// Example:
// With callback (that’s the good thing):
JavaScript.load("", function() {
API.use(); // or whatever api.js provides ...
shangaslammi / webspider.hs
Created Oct 4, 2011
Haskell Web Spider example
View webspider.hs
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
rgreenjr / postgres_queries_and_commands.sql
Last active Oct 17, 2019
Useful PostgreSQL Queries and Commands
View postgres_queries_and_commands.sql
-- 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%'
xian /
Last active Dec 14, 2015 — forked from JakeWharton/
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:

arosien / runar-io-free.scala
Last active Sep 10, 2016
Translation of Runar's ScalaIO 2013 presentation on IO and Free monads ( to scalaz.
View runar-io-free.scala
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 {
staltz /
Last active Oct 18, 2019
The introduction to Reactive Programming you've been missing
Mzk-Levi / ncompositions.scala
Last active Mar 24, 2018
Horizontal & Vertical Compositions of Natural Transformations
View ncompositions.scala
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]
djspiewak /
Created Mar 22, 2015
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

zraffer / package.scala
Last active Apr 26, 2017
a few operations with functors
View package.scala
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
nponeccop / Unfold.hs
Created Aug 16, 2015
Unfolds, coalgebras and anamorphisms
View Unfold.hs
{-# LANGUAGE DeriveFunctor #-}
import Data.Functor.Foldable
import Data.Function
unfold1 :: Unfold Int [Int]
unfold1 = xana coalgebra1
xana :: Unfoldable b => Coalgebra a b -> Unfold a b
xana = ana
You can’t perform that action at this time.