Skip to content

Instantly share code, notes, and snippets.

@adriancooney
adriancooney / route.ts
Created April 29, 2023 16:38
Create a ReadableStream from a OpenAI GPT3/4 LangChain chain for Edge streaming
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) {
import { RESTAdapter } from 'ember-data/adapter';
console.log("here")
export default RESTAdapter.extend({});
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);
@adriancooney
adriancooney / adapters.draft.js
Last active August 27, 2019 11:12
Ember save / set
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);
@adriancooney
adriancooney / controllers.application.js
Created August 13, 2019 13:03
Ember Data Set & Load
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
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
a: Ember.computed(function() {
return 1;
}),
init() {
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: [{
@adriancooney
adriancooney / controllers.application.js
Created July 9, 2019 11:22
Ember Data Relationships
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
});
@adriancooney
adriancooney / controllers.application.js
Last active April 8, 2019 13:21
Ember 3.4 Scheduler Issue
import Ember from 'ember';
import { later, debounce } from '@ember/runloop';
export default Ember.Controller.extend({
sync(schedulerType) {
console.log("syncing via", schedulerType);
},
actions: {
case1() {
Filename: "Capture d’écran 2017-06-01 à 14.27.15.png", key: "970a5cb2-9301-4531-af5e-f36dd75f9b33.Capture d’écran 2017-06-01 à 14.27.15.png"
Filename: "Capture d’écran 2017-06-01 à 14.27.15.png", key: "970a5cb2-9301-4531-af5e-f36dd75f9b33.Capture d’écran 2017-06-01 à 14.27.15.png"
Filename: "Capture d’écran 2017-06-01 à 14.27.15.png", key: "970a5cb2-9301-4531-af5e-f36dd75f9b33.Capture d’écran 2017-06-01 à 14.27.15.png"
Filename: "Screen Shot 2017-06-01 at 12.23.59.png", key: "8c4a630d-f49b-4a11-ae9c-b273183c8c81.Screen Shot 2017-06-01 at 12.23.50.png"
Filename: "Capture d’écran 2017-06-30 à 11.35.14.png", key: "f1c13402-e564-447c-b7ed-e21bf033f9d1.Capture d’écran 2017-06-30 à 11.35.14.png"
Filename: "Capture d’écran 2017-07-31 à 15.07.07.png", key: "dbae3ea6-6d2f-4265-bb1b-aade08c284ce.Capture d’écran 2017-07-31 à 15.07.07.png"
Filename: "Edit-New_Respimat-Übersicht-170802-DK.jpg", key: "17ebe573-a5b2-455a-b430-e217a9ee09ce.Edit-New_Respimat-Übersicht-170802-DK.jpg"
Filename: "Edit-New_R