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 { useRef } = React | |
const Graph = () => { | |
const fgRef = useRef(); | |
return <ForceGraph2D | |
ref={fgRef} | |
graphData={data} | |
nodeCanvasObject={nodeCanvasObject} | |
nodePointerAreaPaint={nodePointerAreaPaint} |
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 nodeCanvasObject(node, ctx, globalScale) { | |
const nodeColour = 'red' | |
const fontSize = 12/globalScale; | |
ctx.font = `${fontSize}px Sans-Serif`; | |
const textWidth = ctx.measureText(node.name).width; | |
const bckgDimensions = [textWidth, fontSize].map(n => n + fontSize * 0.2); // some padding | |
// node circle | |
ctx.fillStyle = 'red' | |
ctx.beginPath() |
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
ReactDOM.render( | |
<ForceGraph2D | |
graphData={data} | |
/>, | |
document.getElementById('graph') | |
) |
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 data = { | |
nodes: [ | |
{ | |
id: "persona-unauthorised-user", | |
name: "Unauthorised user" | |
}, | |
{ | |
id: "persona-authorised-user", | |
name: "Authorised user" | |
}, |
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
struct CVDetailView: View { | |
@State private var cvdata: Data? | |
var body: some View { | |
VStack { | |
if (cvData != nil) { | |
CVPreviewView(pdfData: PDFDocument(data: cvData!)!) | |
} | |
} | |
.onAppear { |
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 SwiftUI | |
import PDFKit | |
import PDFBlocks | |
struct CVPreviewView: UIViewRepresentable { | |
var pdfDocument: PDFDocument | |
init(pdfData pdfDoc: PDFDocument) { | |
self.pdfDocument = pdfDoc | |
} |
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
async function getRecordDetails(recId: String): Promise<Models.Doc> { | |
const client = new Client() | |
.setEndpoint(APPWRITE_URL) | |
.setProject(APPWRITE_PROJECT) | |
.setKey(APPWRITE_API_KEY) | |
const databases = new Databases(client) | |
return databases.getDocument(DATABASE_ID, COL_ID, recId) | |
} |
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 graphqlString = ` | |
mutation Something($somethingData: SomethingInput!) { | |
something(somethingData: $somethingData) { | |
name | |
} | |
} | |
` | |
test('something that requires user auth', async () => { | |
const { jwt } = await getNewUser() |
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
describe('a feature of the app', () => { | |
let server, url | |
beforeAll(async () => { | |
// assigns the values returned to the variables in the upper scope | |
({ server, url } = await createApolloServer({ port: 0 })) | |
}) | |
afterAll(async () => { | |
await server?.stop() |
NewerOlder