View block.ts
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 { match, P } from "ts-pattern"; | |
const headerBlocType = { | |
Header: "header", | |
Paragraph: "paragraph", | |
Image: "image", | |
} as const; | |
interface HeadBlockData { | |
text: string; |
View self-attention.py
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 torch | |
import torch.nn as nn | |
class SelfAttention(nn.Module): | |
def __init__(self, embed_size, heads): | |
super(SelfAttention, self).__init__() | |
self.embed_size = embed_size | |
self.heads = heads | |
self.head_dim = embed_size // heads | |
View Evaluation.ts
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 { makeAutoObservable } from "mobx"; | |
type Choice = { | |
id: number; | |
text: string; | |
}; | |
type Question = { | |
id: number; | |
text: string; |
View useObserver.ts
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 { useEffect, useState } from "react"; | |
class EventBus<T> { | |
_handlers: Set<(t: T) => void> = new Set(); | |
subscribe(handler: (t: T) => void) { | |
this._handlers.add(handler); | |
} | |
unsubscribe(handler: (t: T) => void) { | |
this._handlers.delete(handler); | |
} |
View counterSlice.js
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
// Avec readux toolkit : | |
import { createSlice } from '@reduxjs/toolkit' | |
export const counterSlice = createSlice({ | |
name: 'counter', | |
initialState: { | |
value: 0, | |
}, | |
reducers: { | |
increment: (state) => { |
View FriendLine.js
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 {useFriend} from '../model/useFriend' | |
export function FriendLine ({friend}) { | |
const {fullname, deleteFriend} = useFriend(friend) | |
return (<tr> | |
<td>{fullname}</td> | |
<td><button onclick={deleteFriend} /></td> | |
</tr>); | |
} |
View FriendViewModel.js
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 FriendViewModel { | |
_personalId; | |
_friend; | |
constructor(personalId, friend) { | |
this._personalId = personalId; | |
this._friend = friend; | |
} | |
delete() { |
View firestoreProvider.js
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
// Implement a firestore data provider for react-admin | |
import { | |
GET_LIST, | |
GET_ONE, | |
CREATE, | |
UPDATE, | |
UPDATE_MANY, | |
DELETE, | |
DELETE_MANY, |