Skip to content

Instantly share code, notes, and snippets.

@nickfrosty
nickfrosty / check-seeker-build-env.sh
Created October 1, 2025 01:07
Check and validate's your system to ensure you have the required tooling in order to sign APK builds of Android apps to be published on the Solana Mobile's dApp store (per this guide https://docs.solanamobile.com/dapp-publishing/building-expo-apk on Sept 30, 2025)
#!/bin/bash
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo "=== Android SDK Environment Check ==="
echo ""
@nickfrosty
nickfrosty / url-input.tsx
Created January 16, 2025 14:27
🔥 tip (and a subtle ux improvement): if you require a url in a form, help the user get the url correct for validation - on focus -> auto insert the `https://` to start them off - on blur (and no full url) -> remove the prefix in order to show the placeholder again - when they paste in a url -> fix any duplicate http:// on either side of the inpu…
<Input
placeholder="https://my-project.com"
// this example was from using shadcn/ui forms
{...field}
onFocus={e => {
if (!e.target.value) form.setValue("website", "https://");
}}
onBlurCapture={e => {
if (
!e.target.value ||
@nickfrosty
nickfrosty / solana_compute_usage_cost.rs
Last active January 18, 2025 06:58
Calculate and log the consumed compute units for a block of code in a Solana program
/// Calculate and log the consumed compute units for a block of code
///
/// Note: Syscalls cost [100 CU](https://github.com/anza-xyz/agave/blob/d88050cda335f87e872eddbdf8506bc063f039d3/program-runtime/src/compute_budget.rs#L150)
/// It is also not accessible via a program: https://solana.stackexchange.com/questions/19024/how-can-a-rust-program-get-access-to-the-syscall-base-cost-value
#[macro_export]
macro_rules! compute_usage_cost {
// Log with a custom message
(
$msg:expr => $($tt:tt)*
) => {