Skip to content

Instantly share code, notes, and snippets.

@Saadnajmi
Saadnajmi / Ripple.tsx
Created December 29, 2024 06:31
Ripple Effect Shader with react-native-skia
import { Canvas, Circle, Group, Rect, Shader, Skia, useClock, RuntimeShader, SkRuntimeEffect, RoundedRect } from "@shopify/react-native-skia";
import { SafeAreaView, StyleSheet } from "react-native";
import { useDerivedValue, useSharedValue } from "react-native-reanimated";
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler';
const styles = StyleSheet.create({
centered: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
@gavinmn
gavinmn / KeyboardAttachedView.swift
Created August 20, 2024 02:38
Attach a view to the keyboard with interactive dismissal support
//
// ContentView.Swift
// KeyboardAttachedView
//
// Created by Gavin Nelson on 8/19/24.
//
import SwiftUI
import UIKit
import {
Canvas,
DataSourceParam,
dist,
ImageShader,
rect,
RoundedRect,
rrect,
Shader,
Skia,
@koster
koster / PlayfabLeaderboardManager.cs
Last active October 22, 2024 10:37
Example implementation of a leaderboard manager using Playfab
// a leaderboard manager!
// you'll need a playfab account for this
// https://playfab.com/
using System.Collections;
using System.Collections.Generic;
using PlayFab;
using PlayFab.ClientModels;
@aaronfranke
aaronfranke / convert-to-godot4.sh
Last active April 2, 2024 16:20
This script bulk-renames many things in Godot 3 projects to hopefully make it easier to convert them to Godot 4.
#!/usr/bin/env bash
# This script bulk-renames many things in Godot 3 projects to hopefully
# make it easier to convert them to Godot 4. The goal is to do as much
# replacing as possible here so that the diffs Godot produces are smaller.
set -uo pipefail
IFS=$'\n\t'
# Loops through all text files tracked by Git.
@amannayak0007
amannayak0007 / GradientBg
Last active August 27, 2024 10:40
Animated gradient background
import SwiftUI
struct ContentView: View {
var body: some View {
AnimatedBackground().edgesIgnoringSafeArea(.all)
.blur(radius: 50)
}
}
struct AnimatedBackground: View {
@kelset
kelset / build-time-improvements.md
Last active February 17, 2025 09:47
This is kind of a blogpost about my experience of diving deep to improve some timings for an iOS React Native app

Improving times for both iOS build and CI for a React Native app

Intro

Hello there.

So, if you are here you probably saw my previous tweet where I asked for tips & tricks on improving the timing on an iOS/React Native app build time.

What will follow was how I mixed those suggestions + some good old GoogleSearch-fu + me deep diving on this for ~2 days.

@ohayon
ohayon / DraggableView.swift
Last active April 5, 2023 16:24
Example of making a reusable `draggable()` modifier for SwiftUI Views
struct DraggablePita: View {
var body: some View {
Image(uiImage: UIImage(named: "pita.png")!)
.draggable() // Add the new, custom modifier to make this draggable
}
}
// Handle dragging
struct DraggableView: ViewModifier {
@State var offset = CGPoint(x: 0, y: 0)
@timonus
timonus / programmatic-dynamic-images.m
Last active January 1, 2024 12:08
Programmatically create iOS 13 dynamic images
- (UIImage *)dynamicImage
{
UITraitCollection *const baseTraitCollection = /* an existing trait collection */;
UITraitCollection *const lightTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight]]];
UITraitCollection *const purelyDarkTraitCollection = [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark];
UITraitCollection *const darkTraitCollection = [UITraitCollection traitCollectionWithTraitsFromCollections:@[baseTraitCollection, purelyDarkTraitCollection]];
__block UIImage *lightImage;
[lightTraitCollection performAsCurrentTraitCollection:^{
lightImage = /* draw image */;
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active April 22, 2025 14:27
React Native Bridging Cheatsheet