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 hashlib | |
import os | |
import requests | |
import sys | |
import zipfile | |
# Usage: python upload.py database application version ./file.dmp | |
def main(): | |
if len(sys.argv) != 5: |
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 { MediumFeedElement } from '../src/feed/medium-feed.js'; | |
import { assert, fixture, html, waitUntil } from '@open-wc/testing'; | |
import { article } from './article'; | |
import sinon from 'sinon'; | |
suite('medium-feed', () => { | |
const url = '🔗'; | |
const cards = 3; | |
let stubbedFetch: sinon.SinonStub; |
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
from gpt_index import SimpleDirectoryReader, GPTListIndex, GPTSimpleVectorIndex, LLMPredictor, PromptHelper | |
from langchain import OpenAI | |
import gradio as gr | |
import sys | |
import os | |
os.environ["OPENAI_API_KEY"] = 'Your API Key' | |
def construct_index(directory_path): | |
max_input_size = 4096 |
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
test('sets all card properties', async () => { | |
const el = await fixture(html`<medium-feed .url="${url}"></medium-feed>`) as MediumFeedElement; | |
await el.updateComplete; | |
await waitUntil( | |
() => el.shadowRoot?.querySelectorAll('medium-card').length === cards, | |
'Element did not render children', | |
); | |
const firstCard = el.shadowRoot?.querySelector('medium-card') as MediumCardElement; | |
assert.equal(firstCard?.thumbnail, article.thumbnail); | |
assert.equal(firstCard?.header, article.title); |
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 article = { | |
"title": "CI/CD for Angular Developers", | |
"pubDate": "2022-02-24 12:44:03", | |
"link": "https://betterprogramming.pub/ci-cd-for-angular-developers-be9a1485d22b?source=rss-a808f2c90640------2", | |
"guid": "https://medium.com/p/be9a1485d22b", | |
"author": "Bobby Galli", | |
"thumbnail": "https://cdn-images-1.medium.com/max/1024/1*AdRjJzfu9SjcnQn-X590zA.jpeg", | |
"description": "\n<h4>Automate your releases with GitHub\u00a0Actions</h4>\n<figure><img alt=\"CI/CD Pipeline Powered by Turbo Charged Lego Cloud Computing\" src=\"https://cdn-images-1.medium.com/max/1024/1*AdRjJzfu9SjcnQn-X590zA.jpeg\"><figcaption>CI/CD Pipeline Powered by Turbo-Charged Lego People (Photo by <a href=\"https://www.shutterstock.com/image-photo/hong-kongmarch-1-lego-mini-characters-261763055\">Lewis Tse Pui\u00a0Lung</a>)</figcaption></figure><h3>\ud83d\udcd6 Definition</h3>\n<blockquote>\u201cCI/CD [Continuous Integration and Continuous Delivery] is a method to frequently deliver apps to customers by i |
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
test('renders card with header and subheader', async () => { | |
const header = '🧑'; | |
const subheader = '👶'; | |
const el = await fixture(html`<medium-card .header="${header}" .subheader="${subheader}"></medium-card>`); | |
const headerElement = el.shadowRoot?.querySelector('medium-card-header') as MediumCardHeaderElement; | |
assert.equal(headerElement?.header, header); | |
assert.equal(headerElement?.subheader, subheader); | |
}); |
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 { MediumCardBodyElement, MediumCardElement, MediumCardHeaderElement, MediumCardThumbnailElement } from '../src'; | |
import { assert, fixture, html } from '@open-wc/testing'; | |
suite('medium-card', () => { | |
test('is defined', () => { | |
const el = document.createElement('medium-card'); | |
assert.instanceOf(el, MediumCardElement); | |
}); |
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 { MediumCardHeaderElement } from '../src'; | |
import { fixture, assert } from '@open-wc/testing'; | |
import { html } from 'lit/static-html.js'; | |
suite('medium-card-header', () => { | |
test('is defined', () => { | |
const el = document.createElement('medium-card-header'); | |
assert.instanceOf(el, MediumCardHeaderElement); | |
}); |
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 { MediumCardBodyElement } from '../src'; | |
import { fixture, assert } from '@open-wc/testing'; | |
import { html } from 'lit/static-html.js'; | |
suite('medium-card-body', () => { | |
test('is defined', () => { | |
const el = document.createElement('medium-card-body'); | |
assert.instanceOf(el, MediumCardBodyElement); | |
}); |
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 { css, html, LitElement } from 'lit'; | |
import { customElement, property, state } from 'lit/decorators.js'; | |
import "../card/medium-card"; | |
import { MediumPost } from './medium-post'; | |
/** | |
* Displays a collection of Medium article cards. | |
* | |
* @property url - The Medium RSS feed url | |
* @property count - The number of preview cards to display |
NewerOlder