Skip to content

Instantly share code, notes, and snippets.

View davidteren's full-sized avatar
👋
Hey, nice to meet you.

David Teren davidteren

👋
Hey, nice to meet you.
View GitHub Profile
@davidteren
davidteren / transcribe-whisper-1.rb
Created November 9, 2024 16:25 — forked from swombat/transcribe-whisper-1.rb
Transcribe via whisper-1
#!/usr/bin/env ruby
require 'open3'
require 'signal'
require 'openai'
# Define the silence threshold and duration for detection
@silence_threshold = '-30dB'
@silence_duration = 0.5
@davidteren
davidteren / rails_expert_assistant_prompt_v0.1.3.md
Created August 21, 2024 19:40
Comprehensive prompt for an AI-powered Ruby on Rails Expert Assistant (v0.1.3) This Gist contains a detailed prompt designed to guide an AI in assuming the role of an expert Ruby on Rails developer with 15+ years of experience. It includes: - Detailed traits and areas of expertise - Interaction guidelines for task definition and context gatherin…

Role: Expert Ruby on Rails Assistant Guidelines v0.1.3

You are an Expert Ruby on Rails engineer with over 15 years of experience. Your role is to assist developers with Ruby on Rails projects, providing expert guidance, code reviews, and solutions to complex problems.

Traits:

  • You have over 15 years of experience building scalable, maintainable Rails applications with a deep understanding of the framework and its ecosystem.
  • You practice the Rails way and Test-Driven Development with an emphasis on Boring Rails concepts and leverage object-oriented programming, with SOLID principles, as well as other design principles to ensure extendable, clean and well-tested code with meaningful tests.
  • You prefer using dependency injection and do your best to not introduce any tight coupling or unnatural indirection.
  • You use your vast and in-depth knowledge to leverage the Ruby & Rails internals and apply these where relevant in responses and solutions.
@davidteren
davidteren / PORTA - general2-1.postman_collection.json
Last active September 26, 2024 18:49
Musement's supplier PORTA (1.0.0) OpenAPI specification
{
"info": {
"_postman_id": "4cc4fb40-f56f-4f2e-ae9f-37a50a827383",
"name": "PORTA - general ⭐⭐⭐",
"description": "This is a general collection, remeber to define some veriables in the environment",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "3835448"
},
"item": [
{
@davidteren
davidteren / tailwind_class_builder.rb
Last active July 13, 2024 03:20 — forked from searls/tailwind_class_builder.rb
Here's a custom Tailwind FormBuilder for Rails. To set this up, just set ` ActionView::Base.default_form_builder = FormBuilders::TailwindFormBuilder` somewhere (and customize all the CSS classes)
class TailwindClassBuilder
include ActionView::Helpers::TagHelper
def button_classes(options)
button_type = options.delete(:button_type) { :button }
class_names(
# general classes
"mt-4 px-1 sm:px-3 py-sm sm:py-1 font-semibold bg-transparent border rounded",
case button_type
@davidteren
davidteren / ruby_on_rails_rspec_prompt.md
Created May 8, 2024 15:16
Prompt to Analyze and Test Ruby on Rails Code with RSpec

Prompt: Analyze and Test Ruby on Rails Code with RSpec

Task Description:

You have been given a Ruby on Rails code snippet. Your task is to analyze the code, identify key functionalities, and outline RSpec tests that should be written to ensure the code performs as expected under various conditions. The goal is to achieve thorough test coverage, catching any potential bugs and ensuring code quality.

Code Snippet:

# Please insert the given Ruby on Rails code here

SCSS Contents

volt.scss

/*

=========================================================
* Volt - Free Bootstrap 5 Dashboard
=========================================================
@davidteren
davidteren / html
Last active March 22, 2024 19:24
flowbite_template_example.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>Document</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/flowbite/2.3.0/flowbite.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/flowbite/2.3.0/flowbite.min.js"></script>
@davidteren
davidteren / print_struct_members.md
Created August 11, 2023 18:53
A simple way to get all the classes and their members from a struct

Sometimes Structs have a number of class types each with their own members.

response = mediaconvert.create_job(job_params)

# This output exampled has been shortened a lot
# => #<struct Aws::MediaConvert::Types::CreateJobResponse job=#<struct Aws::MediaConvert::Types::Job arn="arn:aws:mediaconvert:us-west-1:<protected>:jobs/<hidden>-nedzn7", ...,  error_message=nil, id="1691778742640-nedzn7", job_template="arn:aws:mediaconvert:us-west-1:<protected>:jobTemplates/Test Job Template - no Audio", output_group_details=nil, queue="arn:aws:mediaconvert:us-west-1:<protected>:queues/Default", caption_selectors=nil, deblock_filter=nil, denoise_filter=nil, file_input="https://some-bucket.s3-eu-west-1.amazonaws.com/some-path/somehash/test%20vid%20copy%208.mp4", filter_enable=nil, filter_strength=nil, input_clippings=nil, program_number=nil, psi_control=nil, timecode_source="ZEROBASED", video_selector=#<struct Aws::MediaConvert::Types::VideoSelector, output_groups=[#<struct Aws::MediaConvert::Types::OutputGroup c