Skip to content

Instantly share code, notes, and snippets.

View trinnguyen's full-sized avatar

Tri Nguyen trinnguyen

View GitHub Profile
@trinnguyen
trinnguyen / gist:fb50e182cc36f4205a14e6701603f1e9
Created April 1, 2016 19:48
App Transport Security in iOS 9
`App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure`
Solution: Temporary disable all
```
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
```
using System;
using Foundation;
using UIKit;
using System.Collections.Specialized;
using System.Windows.Input;
using MvvmCross.iOS.Views;
namespace AutoLinker
{
// This class is never actually executed, but when Xamarin linking is enabled it does ensure types and properties
@trinnguyen
trinnguyen / ObservableTableViewController.cs
Created April 19, 2016 08:34 — forked from praeclarum/ObservableTableViewController.cs
This is my UITableViewController with DataSource property that listens for INotifyCollectionChanged
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Diagnostics;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace Praeclarum.UI
{
@trinnguyen
trinnguyen / Objective_Sharpie_Sample.txt
Created May 3, 2016 04:16
Xamarin Objective Sharpie samples
#Cocoa Pod Binding
sharpie bind -sdk iphoneos9.2 -o tmp Pods/Headers/Public/NearbyMessages/GNSMessages.h
@trinnguyen
trinnguyen / QuickstartMobileAppConfigurationExtensions.cs
Created May 28, 2016 04:34
Source code of Azure Mobile Server SDK - Quickstart
// ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
using System;
using Microsoft.Azure.Mobile.Server.Tables.Config;
namespace Microsoft.Azure.Mobile.Server.Config
{
public static class QuickstartMobileAppConfigurationExtensions
@trinnguyen
trinnguyen / Distance_Matrix_APIs_JSON
Created June 16, 2016 04:19
Google Maps Distance Matrix APIs JSON response
{
"destination_addresses": [
"76 Lê Lai, Phạm Ngũ Lão, Quận 1, Hồ Chí Minh, Vietnam"
],
"origin_addresses": [
"557A/C6 Nguyễn Tri Phương Tổ 12 KP 3, phường 14, Quận 10, Hồ Chí Minh, Vietnam"
],
"rows": [
{
"elements": [
@trinnguyen
trinnguyen / Metadata.xml
Created June 21, 2016 03:30
Xamarin.Android Binding Linkedin Mobile SDK Android - Metadata.xml
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<!--
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
-->
<!--
@trinnguyen
trinnguyen / keytool_hash
Created June 21, 2016 03:34
Linkedin Mobile SDK Android - generate hash for debug keystore
keytool -exportcert -keystore debug.keystore -alias androiddebugkey | openssl sha1 -binary | openssl base64
@trinnguyen
trinnguyen / UITabbar.cs
Created July 1, 2016 11:02
Add TopLine to UITabbar
//Add line
CALayer topBorder = CALayer.Create();
topBorder.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, 1);
topBorder.BackgroundColor = UIColor.FromRGB(128, 128, 128).CGColor;
TabBar.Layer.AddSublayer(topBorder);
@trinnguyen
trinnguyen / android_statusbarcolor.cs
Created September 24, 2016 06:43
Xamarin.Android SetStastusBarColor
void SetStatusBarColor()
{
if (Build.VERSION.SdkInt < BuildVersionCodes.Kitkat)
{
return;
}
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
Window.ClearFlags(WindowManagerFlags.TranslucentStatus);