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
const std = @import("std"); | |
fn Signal(comptime T: type) type { | |
return struct { | |
message: T, | |
readyToRecieveMessage: std.Thread.Semaphore, | |
messageHasBeenSet: std.Thread.Semaphore, | |
const Self = @This(); |
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
const std = @import("std"); | |
const Buffer = std.ArrayList(u8); | |
const source = [_]u8{ 1, 2, 3, 4, 5 }; | |
const expectedOrder = [_]u8{ 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 }; | |
fn recursive(read: []const u8, write: *Buffer) !void { | |
if (read.len > 0) { | |
try write.append(read[0]); |
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
; 10 SYS (4096) | |
*=$0801 | |
BYTE $0E, $08, $0A, $00, $9E, $20, $28, $34, $30, $39, $36, $29, $00, $00, $00 | |
*=$1000 | |
start |
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
import { createServer, Socket } from "net"; | |
// Promisified socket.write(). | |
const write = (socket: Socket, data: Buffer | string) => | |
new Promise((resolve, reject) => | |
socket.write(data as Buffer, (error: Error | undefined) => { | |
if (error) { | |
reject(); | |
} else { | |
resolve(); |
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
console.log(myFunction()); | |
const myConstant = ""; | |
function myFunction(myArgument: string = myConstant): string { | |
return myArgument; | |
} |
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
-- DROP SCHEMA public CASCADE; | |
-- CREATE SCHEMA public; | |
-- The bad measurements that should be clustered into errors. | |
CREATE STREAM bad_measurements ("measurement" REAL, "timestamp" TIMESTAMPTZ); | |
-- This is only useful because it create an output stream of deltas, important for clustering events. |
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 Model<T> { | |
props: T; | |
constructor(initial: T | void){ | |
if (initial) { | |
this.props = initial; | |
} | |
} | |
set<K extends keyof T>(propName: K, value: T[K]) { | |
this.props[propName] = value; |
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
.full-screen.column | |
.header Header | |
.main.stretchy | |
.left Menu-stuff here | |
ul | |
li Menu Entry | |
li Menu Entry | |
li Menu Entry | |
li Menu Entry | |
li Menu Entry |
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
Data: | |
{"type":"add","uuid":"4b24edb2-5074-4a3a-95cb-927d5535da7c","topic":"clients","data":{"time":"2015-03-23T15:45:34.995Z"}} | |
{"type":"add","uuid":"26ff7bdb-9913-47ab-a6df-8c985320c1bb","topic":"clients","data":{"time":"2015-03-23T15:45:36.082Z"}} | |
{"type":"add","uuid":"914096b8-dc66-4239-bb1c-88baba0c1831","topic":"lines","data":{"time":"2015-03-23T15:45:40.323Z","clientId":"26ff7bdb-9913-47ab-a6df-8c985320c1bb","line":"Hello?"}} | |
{"type":"add","uuid":"bdb60b1e-b34b-490e-a737-0ceb81208f4e","topic":"lines","data":{"time":"2015-03-23T15:45:44.935Z","clientId":"4b24edb2-5074-4a3a-95cb-927d5535da7c","line":"What?"}} | |
{"type":"del","uuid":"4b24edb2-5074-4a3a-95cb-927d5535da7c","topic":"clients"} | |
{"type":"add","uuid":"f9aacc7e-1745-4a54-8e54-b9bea3cbc3bb","topic":"clients","data":{"time":"2015-03-23T15:45:59.800Z"}} | |
{"type":"add","uuid":"2c45cca3-cfa5-4ac2-bfec-12ca985d869b","topic":"lines","data":{"time":"2015-03-23T15:46:15.624Z","clientId":"f9aacc7e-1745-4a54-8e54-b9bea3cbc3bb","line":"Works finw"}} | |
{"type":"ad |
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 '{"foo1":123, "foo":{"bar":[1,2,3]}}' | ./json.js foo.bar.2 |
NewerOlder