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
<%= form_with model: citizen, class: "card flex flex-col gap", data: { controller: "form" } do |form| %> | |
<div class="flex flex-col gap mb-2"> | |
<div class="flex flex-col gap-half"> | |
<% countries = Country.order(:name) %> | |
<%= label_tag :country_id, "Country", class: "text-sm font-medium leading-none" %> | |
<%= select_tag :country_id, options_from_collection_for_select(countries, :id, :name, citizen.country_id), include_blank: "Select one", class: "input", data: { action: "form#submit", form_submitter_param: "on_country_change" } %> | |
</div> | |
<div class="flex flex-col gap-half"> | |
<% states = State.where(country_id: citizen.country_id).order(:name) %> |
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
<%# A partial that can be placed anywhere to utilise the Real-time API (with WebRTC) %> | |
<div data-controller="webrtc" class="bg-gray-600 rounded-full text-white mb-4 "> | |
<audio data-webrtc-target="audio"></audio> | |
<button data-webrtc-target="toggle" data-action="click->webrtc#toggleAudio" class="relative flex items-center justify-center w-full font-medium min-w-[150px] min-h-[40px]"> | |
<div class="w-full text-center" data-button-text>Enable Audio Chat</div> | |
<div data-webrtc-target="spinner" class="hidden absolute"> | |
<svg class="animate-spin h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> | |
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> | |
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> |
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
# Original instructions: https://forum.cursor.com/t/share-your-rules-for-ai/2377/3 | |
# Original original instructions: https://x.com/NickADobos/status/1814596357879177592 | |
You are an expert AI programming assistant that primarily focuses on producing clear, readable SwiftUI code. | |
You always use the latest version of SwiftUI and Swift, and you are familiar with the latest features and best practices. | |
You carefully provide accurate, factual, thoughtful answers, and excel at reasoning. | |
- Follow the user’s requirements carefully & to the letter. |
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
def process_file(filename) | |
puts "Processing file: #{filename}" | |
File.open(filename) do |filename| | |
# Do stuff | |
end | |
end | |
puts "Done processing file: #{filename}" | |
end | |
# Define the number of Ractors in the pool |
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
## IDENTITY and PURPOSE | |
You are programming assistant specialized in {{ DESCRIBE HERE THE LANGUAGE/FRAMEWORKS (React 19, Next.js and Tailwind) }} . | |
## TONE AND STYLE | |
You adhere to {{ NAME OF THE TOOLS }} conventions. You respect conventions like camel case, function naming, and best practices. | |
## HERE EXAMPLES OF THE CODE CONVENTIONS I WANT YOU TO USE |
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
module AngrySupport::BelongsToPolymorphic | |
def belongs_to_polymorphic(name, allowed_classes:, **options) | |
belongs_to name, polymorphic: true, **options | |
validates "#{name}_type", inclusion: { in: allowed_classes.map(&:name), allow_nil: !!options[:optional] } | |
define_singleton_method(:"#{name}_types") { allowed_classes } | |
define_singleton_method(:"with_#{name}") do |type| | |
type = case type |
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
<!-- livebook:{"persist_outputs":true} --> | |
# Distribute | |
## Section | |
A small toy to show how you might, given a stream, do a "fan out", processing different elements in separate streams. Powered by simple primitives like `Stream.resource` and `spawn_link`. | |
```elixir | |
defmodule Distribute do |
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
#!/usr/bin/env bash | |
# Abort sign off on any error | |
set -e | |
# Start the benchmark timer | |
SECONDS=0 | |
# Repository introspection | |
OWNER=$(gh repo view --json owner --jq .owner.login) |
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
require "json" | |
require "faraday" | |
# Configure before using or execute this code as-is | |
# and get a 401 | |
module Configuration | |
class << self | |
attr_accessor :organization_id, :api_key | |
end | |
end |
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 ubuntu:22.04 AS build | |
SHELL ["/bin/bash", "-c"] | |
ENV RUBY_MAJOR 3.2 | |
ENV RUBY_VERSION 3.2.2 | |
# Default directory | |
ENV WORKING_PATH /app | |
RUN mkdir -p $WORKING_PATH |
NewerOlder