class PostsController < ApplicationController
def create
@post = current_user.posts.build(post_params)
if @post.save
flash[:success] = 'Post was successfully created.'
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["field"]
connect() {
.confirm-dialog {
border: none;
border-radius: 12px;
padding: 1.5rem;
max-width: 26rem;
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
import { z } from "zod";
export const signupSchema = z
.object({
email: z.string().min(1, "Email is required").email("Enter a valid email"),
username: z
<%= turbo_frame_tag 'modal' %>
import React from 'react'
interface SkeletonProps {
width?: string | number
height?: string | number
className?: string
import UIKit
class HapticFeedbackManager {
static let shared = HapticFeedbackManager()
private let impactLight = UIImpactFeedbackGenerator(style: .light)
export interface Page<T> {
items: T[];
nextCursor: string | null;
}
export interface Post {
import { z } from 'zod';
export const signupSchema = z
.object({
email: z.string().min(1, 'Email is required').email('Enter a valid email'),
username: z
<%= link_to 'Newest', posts_path(sort: 'new'), data: { turbo_frame: 'results', turbo_action: 'replace' } %>
<%= link_to 'Popular', posts_path(sort: 'popular'), data: { turbo_frame: 'results', turbo_action: 'replace' } %>
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["field", "status"]
static values = {
key: String,
import { useEffect, useState } from "react";
export function useDebouncedValue<T>(value: T, delay = 300): T {
const [debounced, setDebounced] = useState<T>(value);
useEffect(() => {