Skip to content

Instantly share code, notes, and snippets.

View MarcSteven's full-sized avatar
🎯
Focusing on writing code

Marc Steven MarcSteven

🎯
Focusing on writing code
View GitHub Profile
@ArthurNagy
ArthurNagy / RoundedBottomSheetDialogFragment.kt
Last active March 19, 2023 08:14
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
package com.your.package
import android.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom
@rnapier
rnapier / json.swift
Last active January 31, 2024 12:49
Generic JSON Decodable
import Foundation
@dynamicMemberLookup
enum JSON: Codable, CustomStringConvertible {
var description: String {
switch self {
case .string(let string): return "\"\(string)\""
case .number(let double):
if let int = Int(exactly: double) {
return "\(int)"
@lattner
lattner / async_swift_proposal.md
Last active April 21, 2024 09:43 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@inamiy
inamiy / SwiftElmFrameworkList.md
Last active March 11, 2024 10:20
React & Elm inspired frameworks in Swift
//
// MyMetalWaterfall.swift
// version 0.1.105 (updated for Swift 5)
//
// Demonstrates using a MetalKit compute shader to render a live waterfall RGB bitmap
// into a UIView
//
// This is a single file iOS app
//
// It includes AppDelegate for a minimal demonstration app
func push(_ module: Presentable?)
@chriseidhof
chriseidhof / AppDelegate.swift
Created December 13, 2015 15:05
Functional Swift Talk
import UIKit
struct Screen<A> {
let run: (A -> ()) -> UIViewController
}
struct Step<A> {
let build: (navigationController: UINavigationController, callback: A -> ()) -> UIViewController
}
@clementgenzmer
clementgenzmer / FBAnimationPerformanceTracker.h
Last active September 18, 2023 23:02
FBAnimationPerformanceTracker
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 8, 2024 18:07
The best FRP iOS resources.

Videos

@pallabpain
pallabpain / bankers_algo
Created October 20, 2014 18:26
Banker's Algorithm in C
#include<stdio.h>
#include<stdlib.h>
void print(int x[][10],int n,int m){
int i,j;
for(i=0;i<n;i++){
printf("\n");
for(j=0;j<m;j++){
printf("%d\t",x[i][j]);
}