Skip to content

Instantly share code, notes, and snippets.

View trinnguyen's full-sized avatar

Tri Nguyen trinnguyen

View GitHub Profile
@trinnguyen
trinnguyen / .gitignore
Created December 11, 2015 03:53
.gitignore for Xamarin projects
bin/
obj/
*.userprefs
@trinnguyen
trinnguyen / environment.txt
Created December 17, 2015 07:18
for Xamarin.Android project, skip Mono logs by setting level to "error"
MONO_LOG_LEVEL=error
@trinnguyen
trinnguyen / CameraPreviewView.cs
Created February 1, 2016 10:52
CameraPreviewView
using AVFoundation;
using Foundation;
using Masonry;
using System.Threading.Tasks;
using UIKit;
namespace UICode.Camera
{
internal class CameraPreviewView : UIView
{
@trinnguyen
trinnguyen / Extensions.cs
Last active April 5, 2024 16:14
Xamarin.iOS convert between NSDate and DateTime , default LocalTime
using Foundation;
using System;
using System.Collections.Generic;
using System.Text;
namespace UICode.iOS
{
public static class Extensions
{
public static NSDate DateTimeToNSDate(this DateTime date)
@trinnguyen
trinnguyen / GroupedListPage.xaml
Created February 22, 2016 02:19
Sample XAML ListView Grouping for WP8.1
<Page
x:Class="ListViewSamples.CS.Step1.GroupedListPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ListViewSamples.CS.Step1"
xmlns:model="using:ListViewSamples.CS.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
@trinnguyen
trinnguyen / FragmentPushShow.cs
Last active February 24, 2016 15:53
Android Fragment for SetRootViewModel and PushViewModel like iOS UINavigationController
public void SetRootFragment(BaseFragment fragment)
{
//clear all
SupportFragmentManager.PopBackStackImmediate(null, Android.Support.V4.App.FragmentManager.PopBackStackInclusive);
//replace
SupportFragmentManager.BeginTransaction()
.Replace(Resource.Id.content_frame, fragment)
.CommitAllowingStateLoss();
}
@trinnguyen
trinnguyen / MyApplication.cs
Created February 27, 2016 08:33
Xamarin.Android override Application class to get global Context
using System;
using Android.App;
namespace MyApp.Droid
{
[Application(Theme = "@style/MyMaterialTheme")]
public class MyApplication : Application
{
public static Android.Content.Context CurrentContext { get; private set; }
@trinnguyen
trinnguyen / EasyLayout.cs
Last active February 29, 2016 19:48 — forked from praeclarum/EasyLayout.cs
EasyLayout makes writing auto layout code in Xamarin.iOS easier. See [the example](https://gist.github.com/praeclarum/8185036) for hints on how to use this library. #Fixed crash on using static value instead of variable
//
// Copyright (c) 2013-2015 Frank A. Krueger
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
@trinnguyen
trinnguyen / TabActivity.xaml
Created March 5, 2016 04:38
Xamarin.Android TabBar support FULL width
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
@trinnguyen
trinnguyen / report-asp.net-vs-node.js-for-backend-comparison.md
Created March 18, 2016 07:37 — forked from ilyaigpetrov/report-asp.net-vs-node.js-for-backend-comparison.md
Report: Comparison of ASP.NET MVC and Node.js for Backend Programming

Comparison of ASP.NET MVC and Node.js for Backend Programming

We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.

Updates

This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):

  1. Koa.js no longer uses co-routines, it has switched to Babel's async/await.