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
interface SemaHandle { | |
release(): void; | |
} | |
function createSema(concurrency: number): { acquire(): Promise<SemaHandle> } { | |
let handles: string[] = []; | |
const queue: ((value: unknown) => void)[] = []; | |
function createHandle(): string { | |
const handle = nanoid(); |
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 { OpenAI } from "langchain/llms/openai"; | |
import { PromptTemplate } from "langchain/prompts"; | |
import { LLMChain } from "langchain/chains"; | |
import { streamCall } from "./stream-call" | |
export const config = { | |
runtime: "edge", | |
}; | |
export async function GET(request: Request) { |
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 { RESTAdapter } from 'ember-data/adapter'; | |
console.log("here") | |
export default RESTAdapter.extend({}); |
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 Ember from 'ember'; | |
import { inject as service } from '@ember/service'; | |
export default Ember.Controller.extend({ | |
store: service(), | |
appName: 'Ember Twiddle', | |
async init() { | |
// Open the console | |
this.loadDog(1); |
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 DS from 'ember-data'; | |
export default DS.JSONAPIAdapter.extend({ | |
updateRecord(store, type, { record }) { | |
console.log("Saving draft", record.id); | |
return sleep(1000); | |
}, | |
createRecord(store, type, { record }) { | |
console.log("Creating draft", record.body); |
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 Ember from 'ember'; | |
import { inject as service } from '@ember/service'; | |
export default Ember.Controller.extend({ | |
store: service(), | |
appName: 'Ember Twiddle', | |
logs: Ember.A([]), | |
init() { | |
// Add an example 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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
a: Ember.computed(function() { | |
return 1; | |
}), | |
init() { |
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 Ember from 'ember'; | |
import { inject as service } from '@ember/service'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
store: service(), | |
init() { | |
this.store.push({ | |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
}); |
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 Ember from 'ember'; | |
import { later, debounce } from '@ember/runloop'; | |
export default Ember.Controller.extend({ | |
sync(schedulerType) { | |
console.log("syncing via", schedulerType); | |
}, | |
actions: { | |
case1() { |
NewerOlder