This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect, useRef } from 'react'; | |
const ParallaxScrolling = () => { | |
const [scrollY, setScrollY] = useState(0); | |
const [contentHeight, setContentHeight] = useState(0); | |
const containerRef = useRef(null); | |
const contentRef = useRef(null); | |
useEffect(() => { | |
const container = containerRef.current; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<artifacts_info> | |
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity. | |
# Good artifacts are... | |
- Substantial content (>15 lines) | |
- Content that the user is likely to modify, iterate on, or take ownership of | |
- Self-contained, complex content that can be understood on its own, without context from the conversation | |
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations) | |
- Content likely to be referenced or reused multiple times |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
USAGE | |
someView.renderCounter() | |
*/ | |
import SwiftUI | |
struct RenderCounterModifier: ViewModifier { | |
@State private var renderCount: Int = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
USAGE | |
struct ContentView: View { | |
var body: some View { | |
Text("Hello, World!") | |
.onRender { | |
print("View rendered or updated") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FigmaFile { | |
private fileId: string; | |
constructor(fileId: string) { | |
this.fileId = fileId; | |
} | |
async getColors(): Promise<FigmaColor[]> { | |
const response = await fetch(`https://api.figma.com/v1/files/${this.fileId}/`); | |
const json = await response.json(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SpriteKit | |
class Level { | |
let tileSet: SKTileSet | |
let mapSize: CGSize | |
let tileSize: CGSize | |
let tileData: [[Int]] | |
init(jsonData: Data) throws { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lightThemeTokens = { | |
colorPrimary: '#007bff', | |
colorSecondary: '#6c757d', | |
fontSizeSmall: '12px', | |
fontSizeMedium: '16px', | |
}; | |
const darkThemeTokens = { | |
colorPrimary: '#61dafb', | |
colorSecondary: '#c9c9c9', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GameWorld { | |
var systems: [System] = [] | |
var entities: [Entity] = [] | |
var terrain: Terrain? | |
var level: Level? | |
var player: Player? | |
// Add a system to the game world | |
func addSystem(_ system: System) { | |
systems.append(system) |
NewerOlder