Skip to content

Instantly share code, notes, and snippets.

View johnathanludwig's full-sized avatar
🖖
It’s chaos, be kind

Johnathan Ludwig johnathanludwig

🖖
It’s chaos, be kind
View GitHub Profile
.css-selector {
    background: linear-gradient(270deg, #3158f9, #a84cf3, #56abfd);
    background-size: 600% 600%;
    -webkit-animation: AnimationName 9s ease infinite;
    -moz-animation: AnimationName 9s ease infinite;
    -o-animation: AnimationName 9s ease infinite;
    animation: AnimationName 9s ease infinite;
}
@-webkit-keyframes AnimationName {
    0%{background-position:0% 50%}
@aradalvand
aradalvand / DockerfileForSvelteKit.md
Last active July 7, 2024 15:04
Dockerfile and .dockerignore for SvelteKit:

*This Dockerfile is intended for SvelteKit applications that use adapter-node. So, the Dockerfile below assumes that you have already installed and configured the adapter.

Dockerfile:

FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json .
RUN npm ci
COPY . .
RUN npm run build
@kidroca
kidroca / Chart.jsx
Last active June 6, 2024 00:01
Render recharts svg chart inside a PDF document created with react-pdf/renderer
import React from 'react';
import { Global } from 'recharts';
import { htmlSvgToPdfSvg } from '../imageFromSvg';
export const ChartSvg = ({ debug, style, children, width, height }) => {
return chartToPdfSvg(children, width, height, debug, style);
};
const chartToPdfSvg = (children, width, height, debug, style) => {
@stevecastaneda
stevecastaneda / CSSTransition.tsx
Last active May 10, 2024 19:02
CSSTransition component (Typescript). This one allows you use TransitionGroup with Tailwind, animating in a list of items.
import React, { ReactNode } from "react";
import { CSSTransition as ReactTransition } from "react-transition-group";
interface TransitionProps {
in?: boolean;
timeout: number;
enter?: string;
enterFrom?: string;
enterTo?: string;
leave?: string;
@stevecastaneda
stevecastaneda / ModalExample.tsx
Last active July 26, 2020 20:17
[Typescript] Modified Transition React Component to Support Nested Transitions w/ Tailwind
// Modal Source: https://tailwindui.com/components/application-ui/overlays/modals
import React, { ReactNode } from "react";
import { Transition } from "components/transition";
interface Props {
/** The modal open/close state */
open: boolean;
}
@troyfontaine
troyfontaine / 1. Windows.md
Last active June 5, 2024 18:30 — forked from igorkulman/CompareTools.plist
Visual Studio Code as a merge tool for Git Tower.

Enable Visual Studio Code for Merge/Diff on Windows

From PowerShell or CMD:

cd C:\Program Files (x86)\fournova\Tower\CompareTools
code .

Edit VisualStudioCode.json and replace line 10 which is:

@coreyward
coreyward / README.md
Last active November 7, 2021 09:39
I wrote this hook to persist a simple user settings (think dark mode) to local storage in a cross-tab compatible way.

useStorage React Hook

Similar to useState but with some lightweight behind-the-scenes writing to localStorage; also subscribes to changes in localStorage to allow for cross-tab changes to sync automatically.

Example Usage

The first argument is the name of the local storage property/key you want to control with this hook. The second argument, options, really just has one available directive: bool. Setting bool to true has the effect of evaluating the data

@kevinelliott
kevinelliott / osx-10.10-setup.md
Last active December 1, 2023 08:21
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@jberkus
jberkus / gist:6b1bcaf7724dfc2a54f3
Last active January 7, 2024 21:26
Finding Unused Indexes
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end