This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- don't do it like this, especially the json! | |
import Network.WebSockets (shakeHands, getFrame, putFrame) | |
import Network (listenOn, PortID(PortNumber), accept, withSocketsDo) | |
import System.IO (Handle, hClose) | |
import qualified Data.ByteString as B (append, null) | |
import Data.ByteString.UTF8 (fromString) -- this is from utf8-string | |
import Control.Monad (forever) | |
import Control.Concurrent (forkIO, threadDelay) | |
import Data.List (intercalate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<!-- for use with equally crap server at https://gist.github.com/821606 --> | |
<!-- you'll need jquery and flot --> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>Flot Log presenter with External json file</title> | |
<link href="./clientsupport/layout.css" rel="stylesheet" type="text/css"> | |
<script language="javascript" type="text/javascript" src="./clientsupport/jquery.js"></script> | |
<script language="javascript" type="text/javascript" src="./clientsupport/jquery.flot.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
envNodes = mydoc.xpath '//xmlns:environment', mydoc.root.namespaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Function (on) | |
import Data.List (groupBy) | |
import Data.Maybe (mapMaybe) | |
import qualified Data.List.Utils as U | |
type Domain = String | |
type NameServer = String | |
main :: IO () | |
main = interact (processLines . lines) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Function (on) | |
import Data.List (groupBy) | |
import Data.Maybe (mapMaybe) | |
import qualified Data.List.Utils as U | |
type Domain = String | |
type NameServer = String | |
main :: IO () | |
main = interact process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Data.List.Utils as U | |
import Data.List (sort, groupBy, intercalate) | |
import Data.Function (on) | |
-- ------------------------------------------------- | |
-- example data | |
-- ------------------------------------------------- | |
examples :: [(Domain, [NameServer])] | |
examples = [("pachube.com",["7.f.c", | |
"5.f.c", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-- snippet all --} | |
module PodParser where | |
import PodTypes | |
import Text.XML.HaXml | |
import Text.XML.HaXml.Parse | |
import Text.XML.HaXml.Posn | |
import Text.XML.HaXml.Html.Generate(showattr) | |
import Data.Char | |
import Data.List |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Text.XML.HaXml | |
import Text.XML.HaXml.Posn | |
main :: IO () | |
main = processXmlWith (hexagrams `o` tag "IChing") | |
hexagrams :: Content Posn -> [Content Posn] | |
hexagrams = html [ hbody [htable [rows `o` children `with` ( tag "hexagram")] ] ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
-- This is a very simple example of parsing and generating json with Aeson, | |
-- by a haskell newbie and intended for newbies. | |
-- | |
-- This almost certainly contains a number of bad practices. It works for | |
-- me and hopefully will get you started. | |
-- | |
-- I couldn't find a stand-alone example of Aeson usage and found it tricky to | |
-- get going. For example, if you don't realize to enable the language extension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#put this in config/initializers/custom_ac_log_subscriber.rb | |
## needed if we re-enable additions | |
# | |
#require 'active_support/core_ext/object/blank' | |
module MyApp | |
#TODO: we should no longer interit from ActionController::LogSubscriber | |
# as we are not truly unregistering the parent. | |
class CustomAcLogSubscriber < ActiveSupport::LogSubscriber | |
INTERNAL_PARAMS = ActionController::LogSubscriber::INTERNAL_PARAMS |
OlderNewer