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
function dateCheck(year, month, day) { | |
var mon = month - 1; | |
var date = new Date(year, mon, day); | |
if(day !== date.getDate() || mon !== (date.getMonth()) || year !== (1900 + date.getYear())) { | |
return false; | |
} | |
return true; | |
} |
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
trait Component[A <: Component[A]] | |
trait Drawable[A <: Drawable[A] with Coordinates[A]] extends Component[A] | |
trait Coordinates[A <: Coordinates[A]] extends Component[A] { | |
def x: Int | |
def y: Int | |
} |
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
$ cabal install llvm | |
Resolving dependencies... | |
Downloading llvm-base-3.0.1.0... | |
[1 of 1] Compiling Main ( /tmp/llvm-base-3.0.1.0-5657/llvm-base-3.0.1.0/Setup.hs, /tmp/llvm-base-3.0.1.0-5657/llvm-base-3.0.1.0/dist/setup/Main.o ) | |
Linking /tmp/llvm-base-3.0.1.0-5657/llvm-base-3.0.1.0/dist/setup/setup ... | |
Configuring llvm-base-3.0.1.0... | |
configure: WARNING: unrecognized options: --with-gcc | |
checking for g++... g++ | |
checking whether the C++ compiler works... yes | |
checking for C++ compiler default output file name... a.out |
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
application :: MVar ServerState -> WS.Request -> WS.WebSockets WS.Hybi10 () | |
application state rq = do | |
WS.acceptRequest rq | |
WS.getVersion >>= liftIO . putStrLn . ("Client version: " ++) | |
sink <- WS.getSink | |
msg <- WS.receiveData | |
clients <- liftIO $ readMVar state | |
url <- liftIO fbUrl | |
let prefix = "Facebook code " |
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
http = require 'http' | |
for url, i in urls then do (url, i) -> | |
if url.match /^http/i | |
try | |
req = http.request (require 'url').parse(url), (res) -> | |
console.log "##{i}: Fehler #{res.statusCode} bei \"#{url}\"" if res? and res.statusCode isnt 200 | |
req.on 'error', (err) -> | |
console.log "##{i}: Fehler \"#{err.message}\" bei \"#{url}\"" | |
req.end() |
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
events.js:66 | |
throw arguments[1]; // Unhandled 'error' event | |
^ | |
Error: Parse Error | |
at Socket.socketOnData (http.js:1356:20) | |
at TCP.onread (net.js:404:27) |
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
cmake_minimum_required(VERSION 2.8) | |
find_package(BISON) | |
find_package(FLEX) | |
add_definitions(-D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS) | |
BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) | |
FLEX_TARGET(MyScanner tokens.l ${CMAKE_CURRENT_BINARY_DIR}/tokens.cpp) | |
ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser) |
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 Prelude hiding (id, (.)) | |
import Control.Category | |
import Control.Arrow | |
newtype Auto b c = Auto (b -> (c, Auto b c)) | |
instance Category Auto where | |
id = Auto $ \a -> (a, id) |
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 Math.Frustum where | |
import Data.List (foldl') | |
import Data.Vect.Float | |
data Plane = Plane { plNormal :: Vec3, plDist :: Float } | |
newtype Frustum = Frustum { frPlanes :: [Plane] } | |
pointInFrustum :: Vec3 -> Frustum -> Bool |
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
{-# LANGUAGE TemplateHaskell, QuasiQuotes, OverloadedStrings #-} | |
module Loader.Obj where | |
import Control.Applicative ((<$>), (<*>)) | |
import Data.Vect.Float | |
import System.IO (readFile) | |
import Text.Parsec | |
import qualified Text.Parsec.Token as P | |
import Text.Parsec.Language (haskellDef) |