Skip to content

Instantly share code, notes, and snippets.

View tuyen-vuduc's full-sized avatar
🎯
Focusing

Tuyen VU tuyen-vuduc

🎯
Focusing
View GitHub Profile
@tuyen-vuduc
tuyen-vuduc / json2csharp.js
Created January 2, 2017 09:08
JSON to CSharp Generator
function generateClass(className, obj) {
var classes = [];
var buffer = [];
for (var p in obj) {
if (obj.hasOwnProperty(p)) {
var val = obj[p],
type = typeof(val),
name = snakeToPascal(p),
cstype = 'object';
ObservableCollection<$Type$> _$Name$;
public ObservableCollection<$Type$> $Name$
{
get { return _$Name$; }
set
{
if (ReferenceEquals(_$Name$, value)) return;
_$Name$ = value;
@tuyen-vuduc
tuyen-vuduc / fat-framework.sh
Created July 4, 2017 06:53
iOS Fat Lib/Fat Framework
######################
# Options
######################
REVEAL_ARCHIVE_IN_FINDER=true
UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/iphoneuniversal"
OUTPUT_DIR="${PROJECT_DIR}/Output/iphoneuniversal/"
@tuyen-vuduc
tuyen-vuduc / BottomTabbedPage.xaml
Last active July 16, 2017 15:12
BottomTabbedPage.xaml
<forms:BottomTabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:forms="clr-namespace:Naxam.Controls.Forms;assembly=Naxam.BottomTabbedPage.Forms"
xmlns:views="clr-namespace:Naxam.Demo.Views;assembly=Naxam.Demo"
x:Class="Naxam.Demo.MainTabbedPage"
Title="BottomTabbedDemo">
<views:Page1/>
<views:Page2/>
<views:Page3/>
<views:Page4/>
@tuyen-vuduc
tuyen-vuduc / BottomTabbedPageOptionsWithIconize.cs
Last active July 16, 2017 15:14
BottomTabbedPageOptionsWithIconize.cs
void SetupBottomTabs()
{
BottomTabbedRenderer.BackgroundColor = new Color(23, 31, 50);
BottomTabbedRenderer.FontSize = 12.5f;
BottomTabbedRenderer.IconSize = 16;
BottomTabbedRenderer.ItemTextColor = stateList;
BottomTabbedRenderer.ItemIconTintList = stateList;
BottomTabbedRenderer.Typeface = Typeface.CreateFromAsset(this.Assets, "architep.ttf");
BottomTabbedRenderer.ItemBackgroundResource = Resource.Drawable.bnv_selector;
BottomTabbedRenderer.ItemSpacing = 24;
@tuyen-vuduc
tuyen-vuduc / AppWithPopupEnabledNavigationService.cs
Created July 18, 2017 15:10
Prism with PopupPage integration
public partial class App : PrismApplication
{
public App(IPlatformInitializer initializer = null) : base(initializer)
{
}
protected override Prism.Navigation.INavigationService CreateNavigationService()
{
var applicationProvider = Container.Resolve<IApplicationProvider>();
@tuyen-vuduc
tuyen-vuduc / Calabash-ios-scroll-to-top-or-bottom.rb
Last active November 7, 2019 15:32
UITests - iOS - ScrollToBottom
def scroll_to_edge(uiquery, direction)
allowed_directions = [:up, :down]
dir_symbol = direction.to_sym
unless allowed_directions.include?(dir_symbol)
raise ArgumentError, "Expected '#{direction} to be one of #{allowed_directions}"
end
lastYOffset = 99999999.0 * (dir_symbol == :up ? 1 : -1)
while true
@tuyen-vuduc
tuyen-vuduc / HttpContentExtensions.cs
Created October 20, 2017 08:30
Parse JSON from HttpContent with JSON.NET
static class HttpContentExtensions
{
public static async Task<T> DeserializeJsonObjectAsync<T>(this HttpContent content)
{
using (var stream = await content.ReadAsStreamAsync())
{
using (var textReader = new StreamReader(stream))
{
using (var jsonReader = new JsonTextReader(textReader))
{
@tuyen-vuduc
tuyen-vuduc / bprop-create-bindable-property.cs
Created November 12, 2017 15:30
MVVM - C# Snippets (Visual Studio for Mac)
public static readonly BindableProperty $Name$Property = BindableProperty.Create(
nameof($Name$),
typeof($Type$),
typeof($Class$),
default($Type$),
BindingMode.$Mode$);
public $Type$ $Name$
{
get { return ($Type$)GetValue($Name$Property); }
set { SetValue($Name$Property, value); }
@tuyen-vuduc
tuyen-vuduc / class-template.cs
Last active November 12, 2017 18:10
CSharp class template
public class ClassSample
{
pubic static readonly string StatidFieldA;
pubic static readonly string StatidFieldZ;
private static readonly string StatidFieldA;
private static readonly string StatidFieldZ;
public event EventHandler EventA;
public event EventHandler EventZ;