The basics:
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
<? | |
# MIT license, do whatever you want with it | |
# | |
# This is my invoice.php page which I use to make invoices that customers want, | |
# with their address on it and which are easily printable. I love Stripe but | |
# their invoices and receipts were too wild for my customers on Remote OK | |
# | |
require_once(__DIR__.'/../vendor/autoload.php'); |
https://github.com/yjs/yjs/blob/main/INTERNALS.md
https://www.youtube.com/watch?v=0l5XgnQ6rB4 - internals
- 5:20 - defining a type gives you a view into the Items in the CRDT structure. The type is responsible for taking the Items (a linked list) and representing that to the user
- 7:15 - all types extend AbstractType
- 7:50 - everything is a linked list. He implemented a sequence CRDT, and then added maps and XML elements on top of that.
- 9:00 - codebase is small because basically everything is an Item.
- 10:40 - AbstractType always has a list CRDT, and the _start property tells you the first item. Also always has a _map property which maps previously-defined arbitrary string to CRDT, which is the last item in the list CRDT. (This is Replace Operation Manager in the whitepaper.)
- 14:06 - _map is a utility so if the AbstractType is actually storing a map you can look up the last value from the key
- 16:44 - to store tree of directories and their files, you could have a Map that is the file name, and th
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
Function.prototype.myBind = function myBind(ctx, ...baseArgs) { | |
const that = this; | |
return function (...args) { | |
that.call(ctx, ...baseArgs, ...args); | |
} | |
} | |
function tester(...args) { | |
console.log(this.aProp, ...args); |
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 crypto = require("crypto"); | |
const algorithm = "aes-256-ctr"; | |
const password = "Password used to generate key"; | |
// Key length is dependent on the algorithm. In this case for aes192, it is | |
// 24 bytes (192 bits). For ae256, 32 bytes. | |
// Use async `crypto.scrypt()` instead. | |
const key = crypto.scryptSync(password, "salt", 32); | |
// Use `crypto.randomBytes()` to generate a random iv instead of the static iv | |
// shown here. |
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 { Publisher, Subscriber } = require('zeromq'); | |
const PORT = 5000; | |
const args = process.argv.slice(2); | |
const TOPIC = args[0] || 'doc1'; | |
let n = 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
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict | |
This file remaps the key bindings of a single user on Mac OS X 10.5 to more | |
closely match default behavior on Windows systems. This makes the Command key | |
behave like Windows Control key. To use Control instead of Command, either swap | |
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys... | |
or replace @ with ^ in this file. | |
Here is a rough cheatsheet for syntax. | |
Key Modifiers |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>TM Mobile</title> | |
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 React, { useState, FunctionComponent, createRef, DragEvent, ChangeEvent } from 'react'; | |
import classNames from 'classnames'; | |
import { useOnMount, isIE } from '@utilities'; | |
export interface Props { | |
onFileAdded?: (value: File) => any; | |
disabled?: boolean; | |
classes?: string; | |
accepts?: 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
export type LogLevel = 'error' | 'warn' | 'info' | 'debug'; | |
export interface LoggerOpts { | |
level: LogLevel; | |
} | |
export type LogMethods = { | |
[key in LogLevel]: (...messages: any) => void; | |
}; |
NewerOlder