Skip to content

Instantly share code, notes, and snippets.

View chriswitko's full-sized avatar

Chris Witko chriswitko

View GitHub Profile
@chriswitko
chriswitko / Shimmer.swift
Created April 4, 2025 02:36 — forked from xavierLowmiller/Shimmer.swift
Slide-to-Unlock animation in SwiftUI
import SwiftUI
public struct Shimmer: AnimatableModifier {
private let gradient: Gradient
@State private var position: CGFloat = 0
public var animatableData: CGFloat {
get { position }
@chriswitko
chriswitko / zoomImage.css
Created July 15, 2024 13:13 — forked from adilsonfsantos/zoomImage.css
Pure JS/CSS image zoom on click
picture {
cursor: zoom-in;
height: 0;
max-height: 1250px;
max-width: 1400px;
padding-top: 50%;
position: relative;
width: 100%;
&::before {
@chriswitko
chriswitko / style.css
Created November 13, 2023 08:51 — forked from mohammad-ahid/style.css
CSS hack to hide Chrome default date picker styles
// @see http://stackoverflow.com/questions/11320615/disable-browser-native-datepicker
input::-webkit-calendar-picker-indicator{
display: none;
}
input[type="date"]::-webkit-input-placeholder{
visibility: hidden !important;
}
@chriswitko
chriswitko / PomodoroPicker.swift
Created November 24, 2022 03:00 — forked from dmr121/PomodoroPicker.swift
SwiftUI - Snapping horizontal scrolling pomodoro picker
//
// PomodoroPicker.swift
// pomodoro
//
// Created by David Rozmajzl on 1/1/22.
//
import SwiftUI
struct PomodoroPicker<Content, Item: Hashable>: View where Content: View {
@chriswitko
chriswitko / CustomColorScheme.swift
Created October 14, 2022 18:13 — forked from ryanlintott/CustomColorScheme.swift
Custom color scheme view modifier for SwiftUI. Sets the color scheme to light mode, dark mode, or matches the system. If set to match, the app will respond to system-wide color scheme changes properly. A simple widget color scheme implementation is also provided.
import SwiftUI
enum CustomColorScheme: Int, CaseIterable, Identifiable, Codable {
static var defaultKey = "customColorScheme"
static var defaultValue = CustomColorScheme.system
case system = 0
case light = 1
case dark = 2
import UIKit
import SwiftUI
// 🐧 Manager Singleton
class SomeThemeManager: ObservableObject {
static var shared = SomeThemeManager()
@Published var currentTheme = SomeTheme.normal
}

Full socket.io client and server example

Last updated: 2021-02-21, tested with socket.io v3.1.1

This is the simplest implementation you will find for a client/server WebSockets architecture using socket.io.

To see a full explanation, read my answer on SO here: https://stackoverflow.com/a/24232050/778272.

If you're looking for examples using frameworks, check these links:

import { useLoaderData, Link, useSearchParams } from 'remix';
import { parseISO, format } from 'date-fns';
import groupBy from 'lodash/groupBy';
let PAGE_SIZE = 5;
function safeParseInt(str) {
let parsed = parseInt(str);
return isNaN(parsed) ? 0 : parsed;
}
@chriswitko
chriswitko / image.ts
Created January 5, 2022 10:26 — forked from jacob-ebey/image.ts
Remix Image Component
import { createHash } from "crypto";
import fs from "fs";
import fsp from "fs/promises";
import path from "path";
import https from "https";
import { PassThrough } from "stream";
import type { Readable } from "stream";
import type { LoaderFunction } from "remix";
import sharp from "sharp";
import type { Request as NodeRequest } from "@remix-run/node";
@chriswitko
chriswitko / package.json
Created March 7, 2021 14:20 — forked from kentcdodds/package.json
Remove TS from EpicReact.dev workshops
{
"name": "remove-ts",
"version": "1.0.0",
"description": "I use this to automatically fix feedback links in my workshops",
"bin": "./remove-ts.js",
"dependencies": {
"@babel/core": "7.13.8",
"@babel/preset-typescript": "7.13.0",
"glob": "7.1.6"
}