Skip to content

Instantly share code, notes, and snippets.

View superhard's full-sized avatar
🎯
Focusing

Artem superhard

🎯
Focusing
View GitHub Profile
//
// ContentView.swift
// Layout
//
// Created by Matt Gallagher on 7/6/19.
// Copyright © 2019 Matt Gallagher. All rights reserved.
//
import SwiftUI
import Foundation
@propertyWrapper
public struct Validate<Value> {
fileprivate let _isValid: (Value) -> Bool
public let asserts: Bool
public let useLastValid: Bool
public let message: (Value) -> String
@stevestreza
stevestreza / DispatchQueueScheduler.swift
Last active June 29, 2023 13:06
A basic implementation of a Scheduler for Combine. Probably not a great implementation. Useful only as a toy, do not ship this.
//
// DispatchQueueScheduler.swift
//
import Combine
import Foundation
// DO NOT USE THIS IN PRODUCTION
struct DispatchQueueScheduler: Scheduler {
let queue: DispatchQueue
@SergLam
SergLam / AppTypeDefinitions.swift
Last active March 18, 2024 09:09
Photo selection service class for iOS
typealias Localizable = R.string.localizable
typealias TypeClosure<T> = (T) -> Void
typealias VoidClosure = () -> Void
typealias VoidResult = Swift.Result<Void, Error>
typealias VoidResultClosure = (Swift.Result<Void, Error>) -> Void
typealias ImagePickerConfiguration = (source: UIImagePickerController.SourceType,
isLimited: Bool,
import UIKit
import Photos
import Contacts
import AVFoundation
enum Permission {
case cameraUsage
case contactUsage
case photoLibraryUsage
import UIKit
protocol RouterProtocol: Presentable {
func present(_ module: Presentable?)
func present(_ module: Presentable?, animated: Bool)
func push(_ module: Presentable?)
func push(_ module: Presentable?, transition: UIViewControllerAnimatedTransitioning?)
func push(_ module: Presentable?, transition: UIViewControllerAnimatedTransitioning?, animated: Bool)
enum AppDirectories: String {
case documents = "Documents"
case index = "Index"
case libary = "Library"
case temp = "Temp"
}
protocol AppDirectoryNames{
func documentsDirectoryURL() -> URL
func indexDirectoryURL() -> URL
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active March 20, 2025 20:49
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@matteocrippa
matteocrippa / flutter.md
Last active April 20, 2025 03:41
Flutter Cheatsheet

Flutter

A quick cheatsheet of useful snippet for Flutter

Widget

A widget is the basic type of controller in Flutter Material. There are two type of basic Widget we can extend our classes: StatefulWidget or StatelessWidget.

Stateful

StatefulWidget are all the widget that interally have a dynamic value that can change during usage. It can receive an input value in the constructor or reference to functions. You need to create two classes like:

@netsmertia
netsmertia / main.dart
Created May 4, 2018 13:53
flutter image drawing in canvas
import 'package:flutter/material.dart';
import 'dart:ui' as ui;
import 'package:flutter/services.dart' show rootBundle;
import 'dart:async';
import 'dart:typed_data';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.