Skip to content

Instantly share code, notes, and snippets.

View ygmpkk's full-sized avatar
😬
No more monkeys jumping on the bed

Timothy ygmpkk

😬
No more monkeys jumping on the bed
  • didi
  • Hangzhou
View GitHub Profile
@ygmpkk
ygmpkk / gptindex_with_azure_openai_service.py
Created September 11, 2023 09:15 — forked from csiebler/gptindex_with_azure_openai_service.py
Using LlamaIndex (GPT Index) with Azure OpenAI Service
import os
import openai
from dotenv import load_dotenv
from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader, LLMPredictor, PromptHelper
from langchain.llms import AzureOpenAI
from langchain.embeddings import OpenAIEmbeddings
from llama_index import LangchainEmbedding
# Load env variables (create .env with OPENAI_API_KEY and OPENAI_API_BASE)
load_dotenv()
@ygmpkk
ygmpkk / gptindex_with_azure_openai_service.py
Created September 11, 2023 09:15 — forked from csiebler/gptindex_with_azure_openai_service.py
Using LlamaIndex (GPT Index) with Azure OpenAI Service
import os
import openai
from dotenv import load_dotenv
from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader, LLMPredictor, PromptHelper
from langchain.llms import AzureOpenAI
from langchain.embeddings import OpenAIEmbeddings
from llama_index import LangchainEmbedding
# Load env variables (create .env with OPENAI_API_KEY and OPENAI_API_BASE)
load_dotenv()
@ygmpkk
ygmpkk / demo.ts
Created October 14, 2021 05:53
tree to list and list to tree
const toList: any = ({ childrens, ...data }: any) => {
return (childrens || []).reduce(
(prev: any[], { childrens, ...curr }: any) => {
if (childrens?.length) {
prev = prev.concat(recursionFlatten({ childrens, ...curr }))
} else {
prev = prev.concat(curr)
}
return prev
@ygmpkk
ygmpkk / playground.html
Created October 30, 2018 07:19
淘宝小程序 switch
<template>
<view class="container">
<view>
DEBUG MODE: {{ debug }}
</view>
<view>
<switch :checked='debug' @change='handleChanged' />
</view>
</view>
@ygmpkk
ygmpkk / playground.html
Created October 15, 2018 09:57
map makers状态更新问题
<template>
<view class="container">
<view @click='handleRandom'>
更新状态: {{ current }}
</view>
<view v-if='house'>
<map
:longitude='house.location.longitude'
:latitude='house.location.latitude'
:makers='house.location.makers'
<template>
<view class="container">
<view>
<view>
父组件
</view>
<view>
{{ data.today.format('YYYY-MM-DD') }}
</view>
@ygmpkk
ygmpkk / default.conf
Created March 10, 2017 09:37
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
@ygmpkk
ygmpkk / test.js
Created November 1, 2016 03:07
es6 firefix44 problem
'use strict';
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
function test(args) {
var _args = _slicedToArray(args, 2);
var a = _args[0];
var b = _args[1];

Keybase proof

I hereby claim:

  • I am ygmpkk on github.
  • I am ygmpkk (https://keybase.io/ygmpkk) on keybase.
  • I have a public key whose fingerprint is 447C A6EA 69CD 0E72 6058 0931 71C2 518C E3E2 FF87

To claim this, I am signing this object:

@ygmpkk
ygmpkk / best_practices.md
Created July 26, 2016 01:05 — forked from alanpeabody/best_practices.md
Ember Best Practices

Ember Best Practices

Some thoughts and ideas on best practices building Ember apps after 2 years building and maintaining 6+ apps. This is less about the obvious best practices, like use ember-cli, and more along the lines of when to use what technique. As with every best practice there are exceptions to every rule.

Ember data

Ember data relationships

Routing