Skip to content

Instantly share code, notes, and snippets.

View arianvp's full-sized avatar
🎱
Focusing

Arian van Putten arianvp

🎱
Focusing
View GitHub Profile
{} + {}
=> NaN
[] + {}
=> "[object Object]"
{} + []
=> 0
[] + []
=> ""
31
30 Instruction = Operation Space (Operand | Operand Space*, Space* Operand)
29 Line = Linebreak Space*
28 Whitespace = Linebreak | Space
27 Linebreak = U+000A..U+000D | U+0085 | U+2028 | U+2029
26 Space = U+0009 | U+0020 | U+00A0 | U+180E | U+2000..U+200B | U+202f | U+205F | U+3000 | U+FEFF
25
24 Number = IntegerNumber | HexIntegerNumber
23 IntegerNumber = DecimalDigit+
22 DecimalDigit = 0..9
0
1 Instruction = ((Operation Space Operand Space* "," Space* Operand)
2 | (SpecialOperation Space Operand)) Line
3 Line = Linebreak Space*
4 Whitespace = Linebreak | Space
5 Linebreak = U+000A..U+000D | U+0085 | U+2028 | U+2029
6 Space = U+0009 | U+0020 | U+00A0 | U+180E
7 | U+2000..U+200B | U+202f | U+205F | U+3000 | U+FEFF
8
9 Number = IntegerNumber | HexIntegerNumber
import qualified Data.ByteString.Lazy as LBS
data Token = Identifier String
| Colon
| OpenBrace
| CloseBrace
| SET | ADD | SUB | MUL | MLI | DIV | DVI | MOD | mdi | AND | BOR
| XOR | SHR | ASR | SHL | IFB | IFC | IFE | IFN | IFG | IFA | IFL
| IFU | ADX | SBX | STI | STD | JSR | INT | IAG | IAS | RFI | IAQ
| HWN | HWQ | HWI
import qualified Data.ByteString.Lazy as LBS
import Data.Binary.Put
import Data.List
import Data.List.Split
import Text.Regex.Posix
data Token = Identifier String
| IntegerLiteral Integer
| Colon
| OpenBrace
parseToken word = case maybeRead word::(Maybe Word16) of
Just num -> Just $ Word16Literal num
Nothing -> case maybeRead word::(Maybe String) of
Just identifier -> Just $ Identifier identifier
Nothing -> Nothing
parseToken word = case maybeRead word::(Maybe Word16) of
Just num -> Just $ Word16Literal num
Nothing -> case maybeRead word::(Maybe String) of
Just identifier -> Just $ Identifier identifier
Nothing -> Nothing
import qualified Data.ByteString.Lazy as LBS
import Data.Binary.Put
import Data.List
import Data.List.Split
import Data.Maybe
@arianvp
arianvp / gist:3913648
Created October 18, 2012 17:43
DCPU Instruction parsing
/^\s*(\w{3})\s*([^,]+)\s*,?\s*(.*)?\s*$/
The Player Updating process of #317
The player updating process consists of 4 parts:
a) Our player movement updates
b) Other player movement updates
c) Player list updating
c.a) Apperance updating
c.b) Location updating
d) Player update block flag-based updates
<template name="messages">
{{#each messages}}
<li class="{{whichUser this}}">
<article>
<header>
<h2>{{name}}</h2>
<time pubtime datetime="{{timestamp}}">{{prettyDate timestamp}}</time>
</header>
<p>{{text}}</p>