Skip to content

Instantly share code, notes, and snippets.

View kaishin's full-sized avatar

Reda Lemeden kaishin

View GitHub Profile
Copyright© Technovelgy LLC; all rights reserved.
Name Purpose Author (Publication Date) Category
Andy - an artificial human A slang term for "android" - an artificially created humanoid being. Philip K. Dick (1968) ai
Autobutle An automated servant. Frank Herbert (1972) ai
Automaton Chessplayer - the first chess-playing computer The first chess-playing computer. Ambrose Bierce (1910) ai
Automonk A robot with an AI trained on an individual monk. Ray Naylor (2022) ai
Ava - she wants to be taught A piece of learning software. Amitav Ghosh (1995) ai
Bard A machine that invents randomized stories and can read them out loud or animate them for viewing. Isaac Asimov (1956) ai
Bendix Anxiety Reducer Machine-based psychotherapy. Robert Sheckley (1956) ai
Big Computer - wide-screen Jehovah Just like it says; this computer knows it all. John Varley (1983) ai
@OrionReed
OrionReed / dom3d.js
Last active November 15, 2024 17:48
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@atrinh0
atrinh0 / scrollviewreader_crash.swift
Created August 29, 2022 14:41
ScrollViewReader scrollTo crash on Xcode 14
import SwiftUI
struct ContentView: View {
@State private var items: [RandomItem] = (0...25).indices.map { _ in RandomItem() }
var body: some View {
ScrollViewReader { proxy in
List {
ForEach(items) { item in
Text("\(item.number)")
@mbrandonw
mbrandonw / FB10144005.md
Last active June 11, 2024 07:32
iOS 16 Navigation API feedbacks

How to execute logic when NavigationLink is tapped?

FB10144005

Currently it doesn't seem possible to execute additional logic when a navigation link is tapped with the new NavigationLink(value:) initializer. When the link is tapped it updates path state all the way back at the root NavigationStack to drive navigation, but there are many times where we need to perform logic after the tap and before the drill down.

For example, after tapping a link we may want to pre-emptively load some data to show on the drill down screen. Or we may want to perform some form validation. Or we may want to track some analytics. This does not seem possible with the current link API.

A workaround is to use Buttons instead of NavigationLinks, but then you lose all of the styling and affordances given to links, such as chevrons when used in List.

If the API for NavigationLink cannot be changed to accomodate for this, perhaps a new ButtonStyle could be introduced that allows regular buttons to take on the sty

@ryanlintott
ryanlintott / LayoutThatFits.swift
Last active December 8, 2023 15:14
An alternative to ViewThatFits. Updated version can be found here: https://github.com/ryanlintott/LayoutThatFits
//
// LayoutThatFits.swift
// WWDC22Experiments
//
// Created by Ryan Lintott on 2022-06-08.
//
import SwiftUI
struct LayoutThatFits: Layout {
@nikitaame
nikitaame / TCARecursionApp.swift
Last active June 5, 2022 06:48
TCA Circular Reference
import ComposableArchitecture
import SwiftUI
@main
struct TCARecursionApp: App {
var body: some Scene {
WindowGroup {
HomeView(store: .init(initialState: HomeState(), reducer: homeReducer, environment: HomeEnvironment(uuid: UUID.init)))
}
}
import SwiftUI
extension CGPoint {
static func *(lhs: Self, rhs: CGFloat) -> Self {
.init(x: lhs.x * rhs, y: lhs.y * rhs)
}
}
// Idea: https://www.framer.com/showcase/project/lo2Qka8jtPXrjzZaPZdB/
@damirstuhec
damirstuhec / systemcolors.swift
Created January 13, 2022 15:48
iOS System Colors
import SwiftUI
struct ContentView: View {
struct ColorGroup: Hashable {
let colors: [ColorInfo]
let name: String
let description: String
}
struct ColorInfo: Hashable {
@jordanebelanger
jordanebelanger / bytebuffer-serialization.swift
Last active January 21, 2021 15:44
Manually encode and decode a codable type to and from a bytebuffer for redis usage
import Vapor
import RedisKit
struct MySession {
let token: RedisKey
let email: String
let userId: Int64
let isAdmin: Bool
let ipAddress: String?
@krzysztofzablocki
krzysztofzablocki / process.sh
Created January 18, 2021 11:29
3rd party tooling processing script
#!/bin/zsh
cd "$(dirname "$0")/.."
if [[ -n "$CI" ]] || [[ $1 == "--fail-on-errors" ]] ; then
FAIL_ON_ERRORS=true
echo "Running in --fail-on-errors mode"
ERROR_START=""
COLOR_END=""
INFO_START=""