Skip to content

Instantly share code, notes, and snippets.

View Rydgel's full-sized avatar
😂
💯 🔥

Jérôme Mahuet Rydgel

😂
💯 🔥
View GitHub Profile
@lloydmeta
lloydmeta / TwitterFutureSupport.scala
Last active August 29, 2016 22:59
Implicit conversion from a Twitter Future to a Scala Future
import com.twitter.util.{Future => TwitterF}
import scala.concurrent.{Future => ScalaF, Promise => ScalaP}
object TwitterFutureSupport {
/**
Implicit conversion from a Twitter Future to a Scala Future
**/
implicit def twitterFutureToScalaFuture[T](twitterF: TwitterF[T]): ScalaF[T] = {
val scalaP = ScalaP[T]
twitterF.onSuccess { r: T =>
@Rydgel
Rydgel / core.clj
Created June 20, 2014 14:36
Print finished World Cup match results
(ns wc.core
(:require [clj-http.client :as client]))
(defn print-matchs-over []
(let [data-request (client/get "http://worldcup.sfg.io/matches" {:as :json-strict})
completed (filter #(= (:status %) "completed") (:body data-request))]
(doseq [{home-team :home_team away-team :away_team} completed]
(println (str (:country home-team) " " (:goals home-team) " x "
(:country away-team) " " (:goals away-team))))))
@staltz
staltz / introrx.md
Last active September 6, 2025 13:00
The introduction to Reactive Programming you've been missing
@ChristopherBiscardi
ChristopherBiscardi / Data.Haxl.Postgres.DataStoreExample.hs
Created July 5, 2014 01:44
A naive Haxl example Postgres DataStore
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Data.Haxl.Postgres.DataStoreExample
@pjrt
pjrt / TypeclassBox.hs
Last active July 26, 2018 08:55
A Typeclass Box in Haskell. Allows for a single type to represent any type that responds to a typeclass.
{-# LANGUAGE GADTs, ConstraintKinds, FlexibleInstances, RankNTypes #-}
-- Our typeclass with a simple foo :: a -> String func
class Foo a where
foo :: a -> String
-- Our test data types and their instances of Foo
data MyFoo = MyFoo String
data MyBar = MyBar Int
@ifesdjeen
ifesdjeen / Haskell Simplification 1.hs
Last active February 11, 2018 13:05
I've got that piece of code that looks extremely overcomplicated to me. Even though every operation by itself is simple, the "sum" of operations is simply insane.
data Query = Query
data SomeObj = SomeObj
data IoOnlyObj = IoOnlyObj
data Err = Err
-- There's a decoder function that makes some object from String
decodeFn :: String -> Either Err SomeObj
decodeFn = undefined
-- There's a query, that runs against DB and returns array of strings
@divarvel
divarvel / continuation.js
Last active May 11, 2018 08:57
Continuation monad in JS. just run $ node continuation.js
console.log("\033[39mRunning tests…");
function assertEquals(actual, expected, description) {
if(typeof(actual) === "undefined") {
console.error("\033[31m" + description + " not implemented\033[39m");
} else {
if(actual !== expected) {
console.error("\033[31m" + description + " failed, expected " + expected + ", got " + actual + "\033[39m");
} else {
console.log(description + " \033[32m ok\033[39m");
}
@renestalder
renestalder / README.md
Last active August 10, 2025 12:00
Unfollow all on Facebook

Facebook: Unfollow people and pages

See comments section for more up-to-date versions of the script. The original script is from 2014 and will not work as is.

  1. Open news feed preferences on your Facebook menu (browser)
  2. Click people or pages
  3. Scroll down (or click see more) until your full list is loaded
  4. Run the script in your browser console

Facebook will block this feature for you while you use it, depending on how much entities you try to unfollow. It automatically unblocks in a couple of hours and you will be able to continue.

@aryairani
aryairani / AsyncHttpTask.scala
Last active August 29, 2015 14:12
Rewritten AyncHttpClient example for Tim
/**
* Created by arya on 1/2/15.
*/
/*
scalaVersion := "2.11.4"
libraryDependencies += "com.ning" % "async-http-client" % "1.9.3"
libraryDependencies += "org.scalaz" %% "scalaz-concurrent" % "7.1.0"
@gelisam
gelisam / Main.hs
Last active October 5, 2017 10:09
Demonstrating how to use the Haxl library.
{-# LANGUAGE DeriveDataTypeable, GADTs, MultiParamTypeClasses, OverloadedStrings, StandaloneDeriving, TypeFamilies #-}
import Control.Applicative
import Control.Monad
import Data.Hashable
import Data.Typeable
import Haxl.Core
import Text.Printf
data E a where