Skip to content

Instantly share code, notes, and snippets.

<CollectionView
x:Name="PhotoCollectionView"
ItemsSource="{Binding Photos}"
SelectionMode="None">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical" Span="3" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Padding="5">
@olegtyshcneko
olegtyshcneko / EasingFunctions.cs
Created September 22, 2023 01:00
Easing function for unity3d
using Unity.Mathematics;
public static class EasingFunctions
{
public static float EaseInSine(float t)
{
return 1 - math.cos(t * math.PI / 2);
}
public static float EaseOutSine(float t)
@olegtyshcneko
olegtyshcneko / DisplaySynchronizedAnimator.cs
Last active August 6, 2017 14:47
Synced with ui updates animator
public class DisplaySynchronizedAnimator
{
private CADisplayLink animatorLoop;
private bool isFirstTick = true;
private double previousTickTime;
private double deltaTime;
private IDictionary<string, Action<double>> updateSubscribers =
new ConcurrentDictionary<string, Action<double>>();
using static LayoutConstraintExtensions;
public class ConstraintsBuilder
{
private IList<NSLayoutConstraint> constraints = new List<NSLayoutConstraint>();
private UIView constrainsParent;
public ConstraintsBuilder(UIView constrainsParent)
{
this.constrainsParent = constrainsParent;
@olegtyshcneko
olegtyshcneko / NaiveLinearNumberAnimator.cs
Created December 16, 2016 10:33
LinearNumberAnimator
public class NaiveLinearNumberAnimator
{
private double durationSeconds;
private double fromValue;
private double toValue;
private double secondsFromStart;
private double previousTimeStamp;
private bool isFirstTimeStamp = true;
@olegtyshcneko
olegtyshcneko / vc_child.cs
Created December 5, 2015 10:57
xamarin ViewController add child helper
private void AddViewControllerAsChild(UIViewController child, UIViewController parent)
{
child.WillMoveToParentViewController(parent);
parent.AddChildViewController(child);
parent.View.AddSubview(child.View);
child.DidMoveToParentViewController(parent);
}
private void RemoveChildViewController(UIViewController child)
{
@olegtyshcneko
olegtyshcneko / vc_child
Created December 5, 2015 10:57
xamarin ViewController add child helper
private void AddViewControllerAsChild(UIViewController child, UIViewController parent) { child.WillMoveToParentViewController(parent); parent.AddChildViewController(child); parent.View.AddSubview(child.View); child.DidMoveToParentViewController(parent); } private void RemoveChildViewController(UIViewController child) { child.WillMoveToParentViewController(null); child.RemoveFromParentViewController(); child.View.RemoveFromSuperview(); child.DidMoveToParentViewController(null); }
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="blank"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Pull Data"
@olegtyshcneko
olegtyshcneko / LearnKeychainSwift
Last active August 29, 2015 14:13
I've tried to work with iOS keychain API using Swift.
import UIKit
import Security
class ViewController: UIViewController {
private let statusLabel = UILabel(frame: CGRect(x: 20, y: 20, width: 100, height: 25))
override func viewDidLoad() {
super.viewDidLoad()
initLabel()