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
| use std::collections::btree_set::*; | |
| type Id = usize; | |
| #[derive(Debug)] | |
| pub struct BucketArray<T> | |
| { | |
| items: Vec<T>, | |
| free: BTreeSet<usize> | |
| } | |
| impl<T> BucketArray<T> |
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
| use std::collections::hash_map::*; | |
| fn solve(crule: &RuleCont, rules: &HashMap<usize, Rule>, s: &str, offs: usize) -> (usize, bool) | |
| { | |
| let mut moffs = offs; | |
| match crule | |
| { | |
| RuleCont::Seq(irules) => { | |
| let mut valid = true; | |
| let remoffs = moffs; |
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
| use std::collections::hash_map::*; | |
| use std::time::SystemTime; | |
| #[derive(Hash, Copy, Clone, PartialEq, Debug, Eq)] | |
| struct Vec3(i8, i8, i8); | |
| #[derive(Hash, Copy, Clone, PartialEq, Debug, Eq)] | |
| struct Vec4(i8, i8, i8, i8); | |
| impl Vec4 | |
| { |
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
| testData = {- Your data, split by newline -} | |
| data CellType = Seat | Occupied | Floor deriving(Show, Eq) | |
| cellFrom 'L' = Seat | |
| cellFrom '#' = Occupied | |
| cellFrom '.' = Floor | |
| fromJust (Just x) = x | |
| fromJust Nothing = error "unwrapped nothing" |
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
| testData :: [Int] | |
| testData = [11,6,42,19,23,20,26,4,2,36,35,41,18,38,28,1,48,5,17,10,32,15,46,50,24,3,7,6,8,68,83,23,11,16,4,36,9,78,12,29,13,25,42,14,84,10,17,15,18,28,19,21,20,22,35,24,45,30,67,50,23,40,27,26,31,38,33,25,42,29,32,34,57,41,70,43,44,46,65,75,47,48,89,49,51,61,60,52,54,56,99,86,90,72,104,77,78,84,85,95,87,109,132,126,96,108,101,129,233,103,106,172,153,110,128,175,149,150,155,165,161,181,222,180,242,422,238,403,204,258,209,207,213,528,216,635,303,260,259,304,482,299,693,342,326,361,435,384,467,429,607,844,420,842,474,422,762,558,475,476,564,519,620,660,625,1100,641,668,837,745,781,804,903,1167,851,895,894,1587,950,1034,897,951,1039,994,1221,1083,1285,1245,1429,1472,1309,2061,1413,1695,1933,2423,1698,2172,1745,1985,3242,2738,1847,1848,1891,2239,1945,2328,2077,2304,2368,2530,3490,3170,3260,3004,3108,3111,3393,4313,3876,3443,3592,3593,3695,3738,3739,3968,3793,3836,6901,4249,4381,4445,5476,4898,5534,7871,6447,6112,6836,6219,10428,7132,7035,9857,7629,7185,7288,7477,9272,7532,7761,8042,15962,8630,869 |
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
| const NodeType = | |
| { | |
| SEXPR: 0, | |
| BEXPR: 1, | |
| SYMBOL: 2, | |
| NUMBER: 3, | |
| STRING: 4, | |
| ERROR: 5, | |
| FUNC: 6, | |
| INVALID: 7 |
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
| #include <string> | |
| #include <vector> | |
| namespace bn | |
| { | |
| struct XMLTag | |
| { | |
| std::string tagname; | |
| std::vector<XMLTag*> children; | |
| }; |
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
| INCLUDE=. | |
| LIBRARIES=-lX11 -lGL -lpthread -lpng | |
| PROJECT_NAME=myproject | |
| CPP=clang++ | |
| CLFAGS=-std=c++14 | |
| all: build run | |
| build: | |
| $(CPP) $(CLFAGS) -I$(INCLUDE) ./src/** -o a.out $(LIBRARIES) -lc -lm -lstdc++fs |
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
| const PathMaster = require("./pathparser.js"); | |
| console.log(PathMaster.PathParser.parse("///{sfsmx}/{=test_any}/{/[a-z]/g}_{/[a-z]/g}/{&functionName}/")); | |
| /* | |
| Output : | |
| [ | |
| PathParameter { type: 4, value: 'sfsmx' }, | |
| PathParameter { type: 2, value: 'test_any' }, | |
| PathParameter { type: 1, value: /[a-z]/g }, |
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
| #include <inc/drivers/ide/ide.h> | |
| Byte atapiPacket[12]; | |
| UInt8 IDERead(IDEDevice *dev, UInt8 offset) | |
| { | |
| unsigned char result; | |
| if (offset > 0x07 && offset < 0x0C) | |
| IDEWrite(dev, ATA_REG_CONTROL, 0x80 | dev->channel->nIEN); | |
| if (offset < 0x08) |