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 fs from 'fs'; | |
import path from 'path'; | |
import { PDFLoader } from 'langchain/document_loaders/fs/pdf'; | |
import { OpenAI } from 'langchain/llms/openai'; | |
import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; | |
import { SupabaseVectorStore } from 'langchain/vectorstores/supabase'; | |
import { RetrievalQAChain } from 'langchain/chains'; | |
import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter'; | |
import { createClient } from '@supabase/supabase-js'; | |
import * as dotenv from 'dotenv'; |
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 { Project, ts } = require('ts-morph'); | |
const path = require('path'); | |
const filePath = path.join(process.cwd(), './simple_types.ts'); | |
const project = new Project(); | |
project.addExistingSourceFile(filePath); | |
const sourceFile = project.getSourceFile(filePath); | |
const enums = sourceFile.getEnums(); |
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
wakatime |
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
query { | |
repository(owner: "ahonn", name: "blog") { | |
object(expression: "master:README.md") { | |
...on Blob { | |
text | |
} | |
} | |
defaultBranchRef { | |
target { | |
... on Commit { |
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 fish_default_mode_prompt --description "Display the default mode for the prompt" | |
# Do nothing if not in vi mode | |
if test "$fish_key_bindings" = "fish_vi_key_bindings" | |
or test "$fish_key_bindings" = "fish_hybrid_key_bindings" | |
switch $fish_bind_mode | |
case default | |
set_color --bold --background red white | |
echo '[N]' | |
case insert | |
set_color --bold --background green white |
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
// | |
// PagerView.swift | |
// | |
// Created by Majid Jabrayilov on 12/5/19. | |
// Copyright © 2019 Majid Jabrayilov. All rights reserved. | |
// | |
import SwiftUI | |
struct PagerView<Content: View>: View { | |
let pageCount: Int |
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 onPlotClick = (event) => { | |
const { data } = event; | |
if (data) { | |
const { category } = data.point; | |
if (category !== query.category) { | |
setTimeout(() => { | |
const geom = _.first(chartRef.current.get('geoms')); | |
const item = geom.get('data').find(_.propEq('category', category)); | |
geom.setSelected(item); |
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.bind = function (ctx) { | |
var self = this; | |
var nativeSlice = Array.prototype.slice; | |
var args = nativeSlice.call(arguments, 1); | |
return function () { | |
var bindArgs = args.concat(nativeSlice.call(arguments)); | |
return self.apply(ctx, bindArgs); | |
} | |
} |
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 deepClone(source, hash = new WeakMap()) { | |
if (source === null || typeof source !== 'object') { | |
return source; | |
} | |
if (source instanceof Date) { | |
return new Date(source); | |
} | |
if (source instanceof RegExp) { | |
return new RegExp(source); | |
} |
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 myNew(constructor, ...args) { | |
const self = {}; | |
self.__proto__ = constructor.prototype; | |
const obj = constructor.apply(self, args); | |
// 构造函数返回对象或者函数时,直接返回 | |
if (typeof obj === 'object' || typeof obj === 'function') { | |
return obj; | |
} | |
return self; | |
} |
NewerOlder