Skip to content

Instantly share code, notes, and snippets.

View bobbyg603's full-sized avatar
🚀
building dreams

Bobby Galli bobbyg603

🚀
building dreams
View GitHub Profile
@bobbyg603
bobbyg603 / upload.py
Last active April 22, 2024 20:50
BugSplat Python Crash Upload
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:
@bobbyg603
bobbyg603 / medium-feed_network_call_test.ts
Created April 17, 2023 00:51
How to Build a Web Component
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;
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
@bobbyg603
bobbyg603 / medium-feed_card_props_test.ts
Created December 18, 2022 01:42
How to Build a Web Component
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);
@bobbyg603
bobbyg603 / article.ts
Last active December 17, 2022 22:47
How to Build a Web Component
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
@bobbyg603
bobbyg603 / medium-card_header_test.ts
Created December 17, 2022 22:14
How to Build a Web Component
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);
});
@bobbyg603
bobbyg603 / medium-card_test.ts
Created December 17, 2022 19:00
How to Build a Web Component
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);
});
@bobbyg603
bobbyg603 / medium-card-header_test.ts
Created December 17, 2022 16:13
How to Build a Web Component
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);
});
@bobbyg603
bobbyg603 / medium-card-body_test.ts
Created December 17, 2022 16:01
How to Build a Web Component
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);
});
@bobbyg603
bobbyg603 / medium-feed.ts
Created December 13, 2022 22:43
How to Build a Web Component
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