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
require 'rubygems' | |
require 'hpricot' | |
$asciilist = (0x20..0x7e).to_a | [0x09,0x0a,0x0c,0x0d] | |
def parse(lines) | |
arr = Array.new(65536) | |
start = 0 | |
lines.each{|line| |
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
// ==UserScript== | |
// @name WikipediaNotBlock | |
// @version 1.0 | |
// @namespace web2lab.web.fc2.com | |
// @description I support Wikipedia's opinion on SOPA, but let me access Wikipedia. | |
// @include http://en.wikipedia.org/* | |
// ==UserScript== | |
window.addEventListener('DOMNodeInserted',setcss); |
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
-- Haskell unit calc test | |
data (Num a) => Unit a = Unit a a a -- dimensions of meter, kilogram, and second | |
deriving (Eq) | |
instance (Num a)=>Show (Unit a) where | |
show (Unit m k s) = (f "kg" k) ++ " " ++ (f "m" m) ++ " " ++(f "s" s) | |
where | |
f s 0 = "" | |
f s 1 = s |
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 ParseHtml where | |
import Text.ParserCombinators.Parsec | |
import Data.Char | |
import Data.Tree | |
import Data.List | |
import Test.QuickCheck | |
import Control.Monad | |
data Tag = Tag TagName [TagProp] [Content] | TagSingle TagNameSingle [TagProp] | TagScript [TagProp] String deriving (Eq,Show) |
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
Prelude> :m + Text.Regex.Posix | |
Prelude Text.Regex.Posix> let pat = "(foo[a-z]*bar|quux)" | |
Prelude Text.Regex.Posix> "before foodiebar after" =~ pat :: (String,String,String) | |
<interactive>:4:26: | |
No instance for (RegexContext | |
Regex source10 (String, String, String)) | |
arising from a use of `=~' | |
Possible fix: | |
add an instance declaration for |
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
Internal Server Error | |
Ran commands: withTmpDir rm -f /tmp/tmpThreadId84264430607 mkdir /tmp/tmpThreadId84264430607 pwd cd /tmp/tmpThreadId84264430607 writefile /tmp/tmpThreadId84264430607/tmp.hs cd /home/tanakh/hackage-mirror rm -rf /tmp/tmpThreadId84264430607 find /tmp/tmpThreadId84264430607 ls /tmp/tmpThreadId84264430607 Exception: /tmp/.haddock-30607: createDirectory: already exists (File exists) | |
Copyright (c) 2012, Hideyuki Tanaka |
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
-- peggytest.hs | |
{-# Language TemplateHaskell, QuasiQuotes, FlexibleContexts #-} | |
module Nums (numsqq) where | |
import Text.Peggy | |
genParser [("numsqq", "nums")] [peggy| | |
nums :: [Int] | |
= num* |
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 #-} | |
import Data.Attoparsec.ByteString as A | |
import Control.Applicative ((<|>)) | |
import Data.ByteString (ByteString) | |
import qualified Data.ByteString as B | |
import qualified Data.ByteString.Lazy as LB | |
import System.IO | |
import Data.Maybe | |
import Data.String |
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
Configuring SHA-1.6.1... | |
Building SHA-1.6.1... | |
Preprocessing library SHA-1.6.1... | |
[1 of 1] Compiling Data.Digest.Pure.SHA ( Data/Digest/Pure/SHA.hs, dist/build/Data/Digest/Pure/SHA.o ) | |
[1 of 1] Compiling Data.Digest.Pure.SHA ( Data/Digest/Pure/SHA.hs, dist/build/Data/Digest/Pure/SHA.p_o ) | |
In-place registering SHA-1.6.1... | |
Running Haddock for SHA-1.6.1... | |
Preprocessing library SHA-1.6.1... | |
Warning: The documentation for the following packages are not installed. No | |
links will be generated to these packages: rts-1.0 |
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
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
10.times do | |
doc = Nokogiri::HTML(open("http://www.w3.org/html/wg/drafts/html/master/single-page.html")) | |
puts(doc.css("ul > li").length.to_s + " elements.") | |
end |