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 { DurableObject } from "cloudflare:workers"; | |
export class MyDurableObject extends DurableObject<Env> { | |
public sql: SqlStorage | |
constructor(ctx: DurableObjectState, env: Env) { | |
super(ctx, env); | |
this.sql = ctx.storage.sql | |
} |
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
export function Card({ | |
height | |
}: { | |
height: number | |
}) { | |
const scale = height / 390; | |
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => { | |
const card = e.currentTarget; | |
const rect = card.getBoundingClientRect(); |
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
#!/bin/bash | |
# Function to check for jq and install if necessary | |
check_and_install_jq() { | |
if ! command -v jq &> /dev/null; then | |
# Try to install jq based on the system package manager | |
if [[ "$OSTYPE" == "linux-gnu"* ]]; then | |
sudo apt-get update && sudo apt-get install -y jq > /dev/null | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
brew install jq > /dev/null |
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 { useEffect } from 'react' | |
export enum LifecycleVisibilityChange { | |
Visible = 'visible', | |
Hidden = 'hidden', | |
Prerender = 'prerender', | |
Unloaded = 'unloaded', | |
} | |
export const useLifecycle = ({ |
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
@interface ViewController () | |
/** | |
atomic | |
------ | |
- is default behavior | |
- only one thread accesses the variable at a time | |
- is thread safe (read/write safe) | |
- slower in performance (than nonatomic) | |
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 MBProgressHUD; | |
typedef NS_ENUM(NSUInteger, kAPIMethod) { | |
GET, | |
POST, | |
PUT, | |
DELETE | |
}; | |
typedef NS_ENUM(NSUInteger, kAPIEndpoint) { |