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 GlobRegex | |
( | |
globToRegex, | |
matchesGlob | |
) | |
where | |
import Text.Regex.Posix ((=~)) | |
import Data.Char (toLower) | |
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
// originally from http://lousycoder.com/blog/index.php?/archives/91-Scala-Querying-an-objects-fields-and-methods-with-reflection.html | |
package inspectable | |
import scala.Console._ | |
import scala.tools.nsc.util.NameTransformer._ | |
import java.lang.reflect.Modifier._ | |
import java.lang.reflect.{Method, Member, Field} | |
import java.lang.Class |
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
[..e/nick/dev/haskell/markov]$ ghci | |
GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help | |
Loading package ghc-prim ... linking ... done. | |
Loading package integer-gmp ... linking ... done. | |
Loading package base ... linking ... done. | |
Loading package ffi-1.0 ... linking ... done. | |
Prelude> :l markov.hs | |
[1 of 1] Compiling Main ( markov.hs, interpreted ) | |
Ok, modules loaded: Main. | |
*Main> let x = markovChain 1 5 |
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 ForeignFunctionInterface #-} | |
import System.Win32.Types | |
import Foreign | |
import Foreign.C | |
foreign import stdcall unsafe "windows.h GetUserNameW" | |
c_GetUserName :: LPTSTR -> LPDWORD -> IO Bool | |
getUserName :: IO 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
using System; | |
using System.Reflection; | |
using System.Security.Permissions; | |
[assembly:AssemblyVersionAttribute("1.0.2000.0")] | |
public class Metadata | |
{ | |
private int factor; | |
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
-- Echo server program | |
module Main where | |
import Control.Monad (unless,when) | |
import Network.Socket hiding (recv) | |
import qualified Data.ByteString as S | |
import Data.Word(Word8) | |
import Control.Concurrent(threadDelay) | |
import Data.List | |
import Numeric |
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
def enumResultSet[E,A](rs: ResultSet, iter: IterV[E, A], get: ResultSet => IO[E]): IO[IterV[E, A]] = { | |
def loop(i: IterV[E, A]): IO[IterV[E, A]] = | |
i.fold(done = (_, _) => i.pure[IO], | |
cont = k => next(rs) >>= (hasMore => | |
if (!hasMore) i.pure[IO] | |
else get(rs) >>= (t => loop(k(El(t)))))) | |
loop(iter) | |
} |
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
class Program { | |
static void Main(string[] args) { | |
System.Console.WriteLine(System.Reflection.Assembly.ReflectionOnlyLoadFrom(args[0]).ImageRuntimeVersion); | |
} | |
} |
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
C++ = g++ | |
ifndef os | |
os = LINUX | |
endif | |
SRC= $(shell ls *.cpp) | |
OBJS= $(SRC:%.cpp=%.o) | |
DIR = $(shell pwd) | |
Target=test | |
all: $(Target) |
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 ScopedTypeVariables #-} | |
module DynLoad ( | |
loadSourceGhc, | |
execFnGhc | |
) where | |
import Control.Exception (throw) | |
import GHC hiding (loadModule) | |
import GHC.Paths (libdir) | |
import HscTypes (SourceError, srcErrorMessages) |
OlderNewer