Skip to content

Instantly share code, notes, and snippets.

View narciszait's full-sized avatar

Narcis narciszait

  • App developer
  • Copenhagen, Denmark
View GitHub Profile
@narciszait
narciszait / Task.swift
Created June 20, 2023 21:08 — forked from alexito4/Task.swift
SwiftUI View.task backwards compatibility
import Foundation
import SwiftUI
public extension View {
@available(iOS, obsoleted: 15.0, message: "SwiftUI.View.task is available on iOS 15.")
@_disfavoredOverload
@inlinable func task(
priority: _Concurrency.TaskPriority = .userInitiated,
@_inheritActorContext _ action: @escaping @Sendable () async -> Swift.Void
) -> some SwiftUI.View {
//
// LikeView.swift
// lottie-first
//
// Created by Matthew Young on 12/31/22.
//
import SwiftUI
import Lottie
@narciszait
narciszait / allbonjour.swift
Created October 7, 2022 07:24 — forked from fdstevex/allbonjour.swift
Swift command-line script to find Bonjour services on your local network.
#!/usr/bin/swift
// Swift script to search for Bonjour services on the local network.
// Found services are printed to the console.
import Foundation
import CoreFoundation
// Inner search, finds services of a particular type
//
// PlainHorizontalProgressBar.swift
//
// Created by Julia Nikitina on 23.05.2020.
// Copyright © 2020 Julia Nikitina. All rights reserved.
//
import UIKit
@IBDesignable
final class PlainHorizontalProgressBar: UIView {
@narciszait
narciszait / android-7-localization.org
Created December 3, 2021 15:36 — forked from amake/android-7-localization.org
Correct localization on Android 7

Correct localization on Android 7

Prior to Android 7, the system had a single preferred locale, and fallback behavior was quite rudimentary. Starting with Android 7, the user can now specify a priority list of locales, and fallback behavior is improved.

However, in many cases it is still surprisingly difficult to make full use of locale fallback, and there are some hidden gotchas when trying to fully support both Android 7 and earlier versions.

@narciszait
narciszait / SpaceItemDecoration
Created October 5, 2021 14:05 — forked from jaganjan/SpaceItemDecoration
Linear layout manager divider item decoration xamarin android
public class SpaceItemDecoration : RecyclerView.ItemDecoration
{
private readonly bool _addSpaceFirstItem;
private readonly bool _addSpaceLastItem;
private readonly int _space;
public SpaceItemDecoration(int space, bool addSpaceFirstItem, bool addSpaceLastItem)
{
_space = space;
_addSpaceFirstItem = addSpaceFirstItem;
body{
background: #B3E5FC;
}
#wrapper{
height: 615px;
width: 800px;
background: #B3E5FC;
margin: 0 auto;
}
// Code should be so expressive that comment should not be needed to understand the code
//task 1
function calculateAge(birthYear, currentYear){
var currentYear = currentYear;
var birthYear = birthYear;
var age = currentYear - birthYear;
alert("You are either " + age + " or " + age);
}
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>JavaScript exercises</title>
<script type="text/javascript" src="script.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
</head>
<body>
<div id="wrapper">