Skip to content

Instantly share code, notes, and snippets.

View adinapoli's full-sized avatar
🐘

Alfredo Di Napoli adinapoli

🐘
View GitHub Profile
[("GCC extra via C opts", " -fwrapv"),
("C compiler command", "i386-apple-darwin11-clang"),
("C compiler flags", " -U__i686 -fno-stack-protector"),
("C compiler link flags", ""),
("ld command", "i386-apple-darwin11-ld"),
("ld flags", ""),
("ld supports compact unwind", "YES"),
("ld supports build-id", "NO"),
("ld supports filelist", "YES"),
("ld is GNU ld", "NO"),
/Applications/Xcode.app/Contents/Developer/usr/bin/make -r --no-print-directory -f ghc.mk install BINDIST=YES NO_INCLUDE_DEPS=YES
/usr/local/bin/ginstall -c -m 755 -d "/usr/local/lib/i386-apple-darwin11-ghc-7.8.20140130/include"
/usr/local/bin/ginstall -c -m 755 -d "/usr/local/lib/i386-apple-darwin11-ghc-7.8.20140130/include/." && /usr/local/bin/ginstall -c -m 644 includes/./*.h "/usr/local/lib/i386-apple-darwin11-ghc-7.8.20140130/include/./" && /usr/local/bin/ginstall -c -m 755 -d "/usr/local/lib/i386-apple-darwin11-ghc-7.8.20140130/include/rts" && /usr/local/bin/ginstall -c -m 644 includes/rts/*.h "/usr/local/lib/i386-apple-darwin11-ghc-7.8.20140130/include/rts/" && /usr/local/bin/ginstall -c -m 755 -d "/usr/local/lib/i386-apple-darwin11-ghc-7.8.20140130/include/rts/prof" && /usr/local/bin/ginstall -c -m 644 includes/rts/prof/*.h "/usr/local/lib/i386-apple-darwin11-ghc-7.8.20140130/include/rts/prof/" && /usr/local/bin/ginstall -c -m 755 -d "/usr/local/lib/i386-apple-darwin11-ghc-7.8.20140130/includ
{-# OPTIONS -Wall #-}
module Main where
import Control.Concurrent (threadDelay)
import System.Environment (getArgs)
import System.INotify
main :: IO ()
main = do
@adinapoli
adinapoli / String.hs
Created January 22, 2014 21:25
tentative fix for mac os x bug
{-# OPTIONS_GHC -fno-warn-orphans #-}
-----------------------------------------------------------------------------
-- |
-- Module : Text.Regex.Posix.String
-- Copyright : (c) Chris Kuklewicz 2006
-- License : BSD-style (see the file LICENSE)
--
-- Maintainer : [email protected], [email protected]
-- Stability : experimental
-- Portability : non-portable (regex-base needs MPTC+FD)
------------------------------------------------------------------------------
getVideo :: T.Text -> T.Text -> ByteString -> Maybe Video
getVideo ep defaultThumbnail rawJson =
rawJson ^? _Value . to (\o -> Video ep <$>
(o ^? key "id" . _Integer) <*>
(getThumbnail defaultThumbnail o) <*>
(o ^? key "user_id" . _Integer) <*>
(o ^? key "user" . key "first_name" . _String) <*>
(o ^? key "user" . key "last_name" . _String) <*>
(o ^? key "organization_id" . _Integer) <*>
@adinapoli
adinapoli / foo.hs
Last active December 25, 2015 21:29
req' = def {
host = "user:[email protected]",
port = 443,
method = "POST",
responseTimeout = Just timeout,
requestHeaders = headers,
path = twilioPath,
requestBody = RequestBodyBS (C8.pack body),
secure = True }
(defconst hub-pkg-conf
(let* ((hub-env (hub-get-sandbox)))
(if (string= "nohub" hub-env)
'()
'("-g" (make-hub-pkg-conf hub-env)))))
(eval
`(flycheck-define-checker haskell-ghc-mod
"A Haskell syntax and type checker using ghc-mod."
:command ("ghc-mod" "check" "-g" "-Wall"
@adinapoli
adinapoli / PML.hs
Last active December 25, 2015 05:39
{-# LANGUAGE RankNTypes #-}
module PML where
import Data.Functor.Identity
-- Poor Man Lenses
-- Implementation of SPJ's talk
--------------------------------------------------------------------------------
type Lens' s a = forall f. (Functor f) => (a -> f a) -> s -> f s
@adinapoli
adinapoli / asynctest.java
Last active December 21, 2015 22:28
Test to assess that we are not throwing away async goodness
@Test
public void GetRequestAsScalaFutureImmediateReturn2() throws Exception {
HttpClient client = new NingHttpClient();
String fakeUrl = "http://httpbin.org/delay/20";
ActorSystem system = ActorSystem.create("ScalaInterop");
ExecutionContext executionContext = system.dispatcher();
Future<HttpResponse> f = Async.toScalaFuture(client.GET(fakeUrl), executionContext);
System.out.println("Waiting 20 sec to give the time to the future to complete");
Thread.sleep(20000);
System.out.println("I should succeed straight away now...");
package org.cakesolutions.spray.can.examples;
import akka.actor.*;
import akka.io.IO;
import spray.can.Http;
import java.net.InetSocketAddress;
/**
* This example is a mixture of the barebone server here: