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
<?php | |
// Set headers to allow cross-origin resource sharing (CORS) | |
header("Access-Control-Allow-Origin: *"); | |
header("Content-Type: application/json; charset=UTF-8"); | |
header("Access-Control-Allow-Methods: POST"); | |
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"); | |
// Get the JSON data sent in the request body | |
$request_body = file_get_contents('php://input'); |
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 useLoaderPreloadedQuery<Query> = () => { | |
const preloadedQueryRef = useLoaderData() as PreloadedQuery<Query>; | |
// clean up is important as we are using loadQuery directly without useQueryLoader | |
/ which will handle to dispose auto. | |
useEffect(() => () => preloadedQueryRef.dispose(), [preloadedQueryRef]); | |
return preloadedQueryRef | |
} |
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 mongoose from 'mongoose'; | |
const { ObjectId } = mongoose.Types; | |
// transform all ObjectId to string | |
export const mongooseObjectIdToString = (data: any) => { | |
if (!data) { | |
return data; | |
} |
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 Prototype = { | |
Version: '1.7', | |
Browser: (function () { | |
const ua = navigator.userAgent; | |
const isOpera = | |
Object.prototype.toString.call(window.opera) == '[object Opera]'; | |
return { | |
IE: !!window.attachEvent && !isOpera, | |
Opera: isOpera, |
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 { ROOT_TYPE } from 'relay-runtime'; | |
import type { MissingFieldHandler } from 'relay-runtime/lib/store/RelayStoreTypes'; | |
export const missingScalarDebug = { | |
kind: 'scalar', | |
handle(field, record, args, store) { | |
// eslint-disable-next-line | |
console.log('missing scalar', { | |
field, | |
record, |
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 const relayTransactionLogger = (event: LogEvent) => { | |
if (!isDev) { | |
return; | |
} | |
// eslint-disable-next-line | |
console.log('RELAY: ', event); | |
return; | |
} |
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
module.exports = { | |
extends: [ | |
], | |
parser: '@typescript-eslint/parser', | |
parserOptions: { | |
ecmaVersion: 10, | |
sourceType: 'module', | |
ecmaFeatures: { | |
modules: true, | |
}, |
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
it('test SSR', async () => { | |
const response = await request(app.callback()).get('/').send(); | |
expect(response.status).toBe(200); | |
const { getByText } = renderHtml(response.text); | |
expect(getByText('my data')).toBeTruthy(); | |
}); |
- calculus (learn how to find zero of a function, and what is a gradient)
- unsupervised learning (k-means, and other cluster algorithm)
- supervised learning (linear regression, svn, neural net)
- reinforcement learning (llm)
- learn state of art (convolution network, deep learning, attention)