Skip to content

Instantly share code, notes, and snippets.

View JARMourato's full-sized avatar

João Mourato JARMourato

View GitHub Profile
@JARMourato
JARMourato / VisualEffect3.swift
Created April 12, 2025 18:05 — forked from Koshimizu-Takehito/VisualEffect3.swift
visualEffectモディファイア
import SwiftUI
struct ContentView: View {
var body: some View {
GeometryReader { geometry in
let scrollViewFrame = geometry.frame(in: .local)
ScrollView {
ForEach(0..<1000) { offset in
RowContent(offset: offset, scrollViewFrame: scrollViewFrame)
}
@JARMourato
JARMourato / KeyboardToolbar.swift
Created April 1, 2025 16:41 — forked from JamesSedlacek/KeyboardToolbar.swift
SwiftUI Keyboard Toolbar Workaround
//
// KeyboardToolbar.swift
//
// Created by James Sedlacek on 9/20/23.
//
import SwiftUI
import Combine
@Observable
//
// EnvironmentBindable.swift
//
// Created by James Sedlacek on 3/6/24.
//
import SwiftUI
/// A property wrapper that provides a convenient way to bind observable objects from the environment
/// to a SwiftUI view. This wrapper simplifies the process of accessing and binding environment objects
import SwiftUI
extension View where Self: Shape {
func glow(
fill: some ShapeStyle,
lineWidth: Double,
blurRadius: Double = 8.0,
lineCap: CGLineCap = .round
) -> some View {
self
@JARMourato
JARMourato / llms_on_ios.md
Created February 3, 2025 02:06 — forked from awni/llms_on_ios.md
A step-by-step guide to run an LLM on an iPhone with MLX Swift
//
// Persisting.swift
//
// Created by James Sedlacek on 1/30/25.
//
import SwiftUI
/// A property wrapper that manages the persistence of Codable types using UserDefaults.
///
@JARMourato
JARMourato / View+OpenUrl.swift
Created January 29, 2025 09:27 — forked from JamesSedlacek/View+OpenUrl.swift
This file provides a safe way to open URLs in SwiftUI applications.
//
// View+OpenUrl.swift
//
// Created by James Sedlacek on 11/26/24.
//
/// This file provides a safe way to open URLs in SwiftUI applications.
/// It adds a view modifier that handles URL opening with user confirmation
/// and multiple opening options (browser, in-app, or copy to clipboard).
///

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@JARMourato
JARMourato / ChoasLinesShader.metal
Created June 12, 2024 17:00 — forked from realvjy/ChoasLinesShader.metal
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@JARMourato
JARMourato / script.sh
Created June 18, 2023 00:27 — forked from androiddevnotes/script.sh
Bash script to make directory from file name and move the file inside the directory. Run: bash script.sh
#!/bin/bash
for file in $(find . -name "*.md" -type f)
do
echo "file: $file"
filenamewithextension=${file##*/}
echo "file name with extension: $filenamewithextension"
mkdir ${filenamewithextension%.*}
echo "file name without extension: ${filenamewithextension%.*}"
mv ${filenamewithextension} ${filenamewithextension%.*}/${filenamewithextension}
done