Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjamin Mayrargue softlion

View GitHub Profile
@softlion
softlion / IScreenLocation.cs
Last active Feb 6, 2022
Xamarin Forms get absolute bounds of a control and display a menu at this location
View IScreenLocation.cs
namespace Vapolia
{
public interface IScreenLocation
{
PointF GetCoordinates(VisualElement view);
}
}
@softlion
softlion / connect_linkedin.js
Created Nov 13, 2019 — forked from bertolo1988/connect_linkedin.js
Quickly your LinkedIn network
View connect_linkedin.js
// 1. load https://www.linkedin.com/mynetwork/
// 2. make sure your LinkedIn is in English
// 3. paste this script on chrome dev tools at your own risk
async function moreConnectionsPlease() {
// maximum limit of Connect buttons clicked
const LIMIT = 500;
// wait in ms before each scroll
const SCROLL_TIMEOUT = 600;
// bulk scroll will scroll this amount of times
View ShimmerExtensions.cs
//Xamarin iOS
using System;
using System.Runtime.InteropServices;
using CoreAnimation;
using CoreGraphics;
using Foundation;
using UIKit;
namespace Vapolia.Ios.Lib.Ui
{
@softlion
softlion / RealtimeBlurView.cs
Created Feb 25, 2019
Xamarin RealtimeBlurView
View RealtimeBlurView.cs
using System;
using Android.App;
using Android.Content;
using Android.Content.Res;
using Android.Graphics;
using Android.Renderscripts;
using Android.Runtime;
using Android.Util;
using Android.Views;
using R = VfrApp.Droid.Resource;
View log vs2017.txt
Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the NuGet Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
Running restore with 8 concurrent jobs.
Reading project file C:\Dev\repos\Company\Company.AirAppApp\AirApp.Core\AirApp.csproj.
Reading project file C:\Dev\repos\Company\Company.AirAppApp\AirApp.Droid\AirApp.Droid.csproj.
Reading project file C:\Dev\repos\Company\Company.AirAppApp\Company2.Toolbox\Company2.Toolbox.csproj.
Reading project file C:\Dev\repos\Company\Company.AirAppApp\AirApp.iOS\AirApp.iOS.csproj.
The restore inputs for 'Company2.Toolbox' have not changed. No further actions are required to complete the restore.
Committing restore...
Assets file has not changed. Skipping assets file writing. Path: C:\Dev\repos\Company\Company.AirAppApp\Company2.Toolbox\obj\project.assets.json
@softlion
softlion / ParallaxHeaderBehavior.cs
Created Aug 6, 2018
A Parallax header for your RecyclerView using a CoordinatorLayour Behavior (Android Development)
View ParallaxHeaderBehavior.cs
using System;
using Android.Content;
using Android.Runtime;
using Android.Support.Design.Widget;
using Android.Support.V4.View;
using Android.Support.V4.Widget;
using Android.Support.V7.Widget;
using Android.Util;
using Android.Views;
using Object = Java.Lang.Object;
@softlion
softlion / poeditor-export.js
Created Feb 9, 2018
poeditor: export all projects/languages to resx files (or any format)
View poeditor-export.js
//Install nodejs and the npm dependencies:
//npm install node-poeditor
//npm install async-file
//npm install linq-es2015
//npm install requisition
//
//run:
//node poeditor-export.js
const token = 'you-api-token-here';
@softlion
softlion / ParallaxHeaderExtension.cs
Created Jan 5, 2018
Xamarin objc_getAssociatedObject / objc_setAssociatedObject snippet
View ParallaxHeaderExtension.cs
public class ParallaxHeader : UIView
{
public UIScrollView ScrollView { get; set; }
}
public static class ParallaxHeaderExtension
{
private static readonly NSString DescriptiveName = new NSString("Vapolia." + nameof(ParallaxHeader));
enum AssociationPolicy {
View 01-Visibility2TargetBinding.md

Abstract

Mvvmcross includes a convert which translates a boolean into an MvxVisibility enumerable, and a target binding on each platform which translates an MvxVisibility to either a View.Visibility on Android, or an inverted boolean for UIView.Hidden on iOS.

Its usage requires to use a magic string ("Visibility") 2 times in the binding description. And it supports only boolean values in the viewmodel.

And last, it is distributed as a Mvvmcross plugin, which slows down the app's startup time, and crashes the app when the "link all" build option is activated", unless you add special code to prevent it. If you forget to add the plugin, it won't crash, it won't log, and you may search for your error a long time before remembering to add the plugin.

@softlion
softlion / SvgTabbedPageRenderer.cs
Created Nov 22, 2017
SvgTabbedPageRenderer to get icons on tab on Android with Xamarin.Forms (see https://github.com/softlion/XamSvg-Samples)
View SvgTabbedPageRenderer.cs
using System;
using System.Threading;
using Android.Content;
using Android.Support.Design.Widget;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android.AppCompat;
using XamSvg.Demo.Droid;
using XamSvg.XamForms;
[assembly:ExportRenderer(typeof(TabbedPage), typeof(SvgTabbedPageRenderer))]