Skip to content

Instantly share code, notes, and snippets.

@ericksoa
ericksoa / gitClient.ts
Created March 21, 2023 21:48
Client to do all the git things
// gitClient.ts
import { Octokit } from '@octokit/rest';
export class GitClient {
private octokit: Octokit;
private owner: string;
private repo: string;
constructor(baseURL: string, apiToken: string, owner: string, repo: string) {
this.octokit = new Octokit({
@ericksoa
ericksoa / jiraClient.ts
Created March 21, 2023 21:46
Read the Jira story to let the robot implement
// jiraClient.ts
import axios, { AxiosInstance } from 'axios';
export class JiraClient {
private apiClient: AxiosInstance;
constructor(baseUrl: string, apiToken: string) {
this.apiClient = axios.create({
baseURL: `${baseUrl}/rest/api/3/`,
headers: {
@ericksoa
ericksoa / openApiClient
Created March 21, 2023 21:43
Generate code according to a spec given by the product manager
// openAIClient.ts
import { OpenAIApi } from '@openai/api';
export class OpenAIClient {
private openai: OpenAIApi;
constructor(apiKey: string) {
this.openai = new OpenAIApi({
apiKey: apiKey,
});
@ericksoa
ericksoa / main.ts
Created March 21, 2023 21:39
Automate the job of a programmer picking up a story
// main.ts
import { JiraClient } from './jiraClient';
import { OpenAIClient } from './openAIClient';
import { GitClient } from './gitClient';
async function main() {
// Configure your clients
const jiraClient = new JiraClient('https://your-jira-instance.atlassian.net', 'your-jira-api-token');
const openAIClient = new OpenAIClient('your-openai-api-key');
const gitClient = new GitClient('https://your-git-instance.com', 'your-git-api-token');
@ericksoa
ericksoa / fancygraph.tsx
Created March 21, 2023 19:12
Up and to the right, hurray!
// src/components/GrowthChart.tsx
import React from 'react';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';
interface GrowthData {
month: string;
revenue: number;
}
interface GrowthChartProps {
@ericksoa
ericksoa / panopticon.ts
Created March 21, 2023 19:08
Gather calendar events and commit stats for use in your upcoming 1:1 meeting
import { exec } from "child_process";
import { google } from "googleapis";
import { Credentials } from "google-auth-library";
import axios from "axios";
const OPENAI_API_KEY = "<your_openai_api_key>";
const GIT_REPO_PATH = "<your_git_repo_path>";
const GOOGLE_CREDENTIALS = <your_google_credentials> as Credentials;
async function getCommitStats(email: string, fromDate: string, toDate: string): Promise<string> {
@ericksoa
ericksoa / weeklyReport.ts
Created March 21, 2023 18:56
Summarize your work from Jira into an engaging narrative for your boss
// Step 1: Setup your development environment and install required dependencies.
// Install required packages using npm or yarn:
// npm install axios @types/axios dotenv openai @types/node
// or
// yarn add axios @types/axios dotenv openai @types/node
import axios, { AxiosResponse } from 'axios';
import * as dotenv from 'dotenv';
import * as openai from 'openai';
@ericksoa
ericksoa / styles.css
Created March 20, 2023 01:42
Chrome Twitter Refex Blocker - styles.css
/* Add any custom styles here */
@ericksoa
ericksoa / content.js
Created March 20, 2023 01:40
Chrome Plug In Block By Regex - content.js
const regexPattern = /your-regex-pattern/;
function hideTweet(tweet) {
tweet.style.display = 'none';
}
function processTweets() {
const tweets = document.querySelectorAll('[data-testid="tweet"]');
for (const tweet of tweets) {
const tweetText = tweet.textContent;
@ericksoa
ericksoa / manifest.json
Created March 20, 2023 01:35
Twitter Regex Blocker Chrome Plugin - manifest.json
{
"manifest_version": 2,
"name": "Twitter Regex Filter",
"version": "1.0",
"description": "Hides tweets containing text that matches a given regex pattern.",
"permissions": ["https://twitter.com/*"],
"content_scripts": [
{
"matches": ["https://twitter.com/*"],
"js": ["content.js"],