This file contains hidden or 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 System.IO (hPutStrLn, stderr) | |
import Control.Exception (catch, IOException, SomeException) | |
import Prelude hiding (catch) | |
readFileWithDefault :: FilePath -> String -> IO String | |
readFileWithDefault filepath defaultString = | |
catch | |
(readFile filepath) | |
(\e -> do | |
return (e::SomeException) |
This file contains hidden or 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 Network.HTTP | |
import Codec.Binary.UTF8.String | |
queryString :: String | |
queryString = "ひとし+君" | |
queryRPP :: Int | |
queryRPP = 10 | |
makeRequestUrl :: String |
This file contains hidden or 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
fromResult :: Result a -> Maybe a | |
fromResult (Ok k) = Just k | |
fromResult (Error e) = Nothing | |
maybeFromObj :: JSON a => String -> JSObject JSValue -> Maybe a | |
maybeFromObj k o = maybe (Nothing) (fromResult . readJSON) (lookup k (fromJSObject o)) |
This file contains hidden or 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 (main) where | |
import System.Environment (getArgs) | |
import System.Console.GetOpt | |
data SearchOptions | |
= Query String | Rpp Int | Lang String | OutputFile String | |
deriving (Show) | |
options :: [OptDescr SearchOptions] |
This file contains hidden or 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 System.Cmd | |
import Data.Graph.Inductive | |
import Data.Graph.Inductive.Graphviz | |
import Data.Graph.Inductive.Example | |
myGraph :: Gr String () | |
myGraph = mkGraph |
This file contains hidden or 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 System.Directory | |
import Control.Monad | |
import Data.List | |
import Text.Regex | |
import Text.Regex.Posix | |
recursiveFiles :: FilePath -> IO [FilePath] |
This file contains hidden or 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
Set WSHShell = CreateObject("WScript.Shell") | |
WSHShell.Run "cmd.exe /c milk web", vbhide |
This file contains hidden or 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 System | |
import Data.List | |
import Control.Monad | |
separateDiffPatch :: String -> [String] | |
separateDiffPatch str = map unlines . map (head . filter patchEnd . inits) . (filter patchStart . tails) . lines $ str | |
where | |
patchStart (l0 : l1 : l2 : ls) = and [isPrefixOf "From " l0, isPrefixOf "From: " l1, isPrefixOf "Date: " l2] |
This file contains hidden or 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
########################### | |
# windows only | |
########################### | |
#import sublime | |
import sublime_plugin | |
import os | |
import os.path | |
OlderNewer