Skip to content

Instantly share code, notes, and snippets.

View jessejiang0214's full-sized avatar

Jesse Jiang jessejiang0214

View GitHub Profile
@jessejiang0214
jessejiang0214 / gist:cec57ddbe6c95b30e84013b61fb76eb5
Created August 10, 2022 11:23
Change plist based on environment python
#!/usr/bin/env python3
import argparse
import subprocess
import shlex
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('--environment',
@jessejiang0214
jessejiang0214 / gist:e3db31b830f7c9f91abc2a70746851d2
Created August 10, 2022 11:21
Xamarin iOS project based on config change plist
<None Include="Info.plist" Condition="'$(Configuration)' != 'Release' " />
<None Include="InfoTest.plist" Condition="'$(Configuration)' == 'Release'">
<LogicalName>Info.plist</LogicalName>
</None>
@jessejiang0214
jessejiang0214 / FilterScriptPhase.sh
Last active December 16, 2019 22:44 — forked from steipete/FilterScriptPhase.sh
This filter script phase is required to remove unused architectures from your application, which would be flagged as issue during upload to the Apple AppStore. Read more at http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
@jessejiang0214
jessejiang0214 / AndroidGetUUIDFromAdv.cs
Created December 11, 2017 03:26
As filter in startLeScan is not working, use this function to filter the UUID
// Solution from https://stackoverflow.com/questions/18019161/startlescan-with-128-bit-uuids-doesnt-work-on-native-android-ble-implementation
List<string> ParseUUIDs(byte[] advertisedData)
{
List<string> uuids = new List<string>();
int offset = 0;
while (offset < (advertisedData.Length - 2))
{
int len = advertisedData[offset++];
if (len == 0)
break;
@jessejiang0214
jessejiang0214 / BasePage.cs
Last active June 13, 2019 14:46
Custom navigation bar in Xamarin.Forms PCL
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace {YOURNAMESPACE}
{
public class BasePage : ContentPage
{
ContentView _header;
public ContentView Header
@jessejiang0214
jessejiang0214 / CustomAllViewCellRendereriOS.cs
Created January 25, 2016 05:30
Disable Xamarin Forms ListView select item HightLight color
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer (typeof(ViewCell), typeof(MyAPP.iOS.CustomAllViewCellRendereriOS))]
namespace MyAPP.iOS
{
public class CustomAllViewCellRendereriOS : ViewCellRenderer
{
public override UIKit.UITableViewCell GetCell (Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
@jessejiang0214
jessejiang0214 / RoundBorderDatePicker.cs
Last active October 8, 2022 09:42
This is the Xamarin Forms date picker extension. It can set border width, color and radius, also it can add PlaceHolder and MinimumAge
using System;
using Xamarin.Forms;
namespace MyApp
{
public interface ICanBeValidated
{
Action<bool> ValidateChange { get; set; }
bool IsValidated { get; set; }
@jessejiang0214
jessejiang0214 / NavigationPageRendereriOS.cs
Last active January 17, 2016 07:43
Back icon renderer ios
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using UIKit;
[assembly: ExportRenderer (typeof(ContentPage), typeof(ChangeBackIcon.iOS.NavigationPageRendereriOS))]
namespace ChangeBackIcon.iOS
{
public class NavigationPageRendereriOS : PageRenderer
{
@jessejiang0214
jessejiang0214 / ChangeBackIcon.Droid.cs
Last active March 24, 2016 04:07
Change back icon Android renderer
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using Android.Graphics.Drawables;
using Android.Widget;
[assembly: ExportRenderer (typeof(ContentPage), typeof(ChangeBackIcon.Droid.NavigationPageRendererDroid))]
namespace ChangeBackIcon.Droid
{
public class NavigationPageRendererDroid : PageRenderer