Skip to content

Instantly share code, notes, and snippets.

View Zeko369's full-sized avatar
:octocat:
Building cool stuff

Fran Zekan Zeko369

:octocat:
Building cool stuff
  • Zagreb, Croatia
  • 22:30 (UTC +02:00)
  • X @Zeko369
View GitHub Profile
"use client";
import { useQuery } from "@tanstack/react-query";
import { useEffect, useState } from "react";
const apiCall = (url: string, options: RequestInit) => {
return fetch(url, {
...options,
headers: {
...options.headers,
alias yeet="gt ss"
alias yeetpr="git push && gh pr create -a @me -f"
yeetfix() {
# Merge all arguments into a single string with spaces
local commit_message="$*"
# Replace spaces in the commit message with dashes for the branch name
local branch_name=$(echo "$*" | tr ' ' '-' | tr '[:upper:]' '[:lower:]')
# Create a new branch
git checkout -b "$branch_name"

SETUP

python3 -m venv venv
source ./venv/bin/activate
pip3 install -r requirements.txt
bunx playwright codegen --timeout 100000 --save-storage=auth.json
if ARGV.any? { |arg| %w[db:drop db:reset db:setup].include?(arg) } && ENV['YES_DROP'] != 'true'
# this is wrapped in a method for easier early returns
def check_db_drop
require 'dotenv'
require 'json'
env = Dotenv.parse('.env')
db_url = env['DATABASE_URL']
unless db_url.nil?
model Database {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
slug String @unique
columns DatabaseColumn[] @relation("inDb")
rows DatabaseRow[]
belongsTo User @relation(fields: [belongsToId], references: [id])
belongsToId String
import { PrismaClient } from "@prisma/client";
const mode = Bun.argv[2] === "manual" ? "manual" : "transaction";
console.log(`Running in ${mode}`);
async function createSocialLoginMigration(
prismaClient: PrismaClient,
providerName: "google" | "github"
) {
const users = await prismaClient.user.findMany({
class PostsController < ApplicationController
def index
end
def new
@post = Post.new(date: params[:date])
end
private
<h2><%= request.fullpath %></h2>
<ul>
<% @topics.each do |topic| %>
<li>
<%= link_to topic.name, sandbox_path(topic_id: topic.id) %>
</li>
<% end %>
</ul>
<?php
require '../vendor/autoload.php';
use Jumbojett\OpenIDConnectClient;
$local_url = "http://localhost:5001";
session_start();
if (isset($_GET['clear_session'])) {
const thisIsCsssFunction = (args: string) => {
return "foo";
};
// export const { defineAction, defineQuery, defineJob } = thisIsCsssFunction(
// /*css*/ `.foo { color: red }`
// );
const defineAction = <T extends string, K>(name: T, act: K) => {
return { [name]: act } as { [P in T]: K };