Skip to content

Instantly share code, notes, and snippets.


Alex Lau alexlau811

View GitHub Profile
alexlau811 / gamedev1.js
Created Apr 21, 2015
Code Avengers Sample Code
View gamedev1.js
// Help message
new Game.Text('Warrior! Grab all', 50, 0);
new Game.Text('Hong Kong 1 Dollar to save the world!!', 50, 25);
// Setup player & guns
function createPlayer1() {
var player = new Game.Player(0, 0, '/image/game/player1.png');
player.onKilled = createPlayer1;
alexlau811 / OverrideFormattedStringExtension.cs
Created Mar 8, 2015
Override default FormattedString behaviour to allow custom font to be used in Label of Xamarin.Forms.Android
View OverrideFormattedStringExtension.cs
public static class OverrideFormattedStringExtension
// Static Methods
public static SpannableString ToAttributed(this FormattedString formattedString, Font defaultFont, Color defaultForegroundColor, TextView view)
if (formattedString == null)
return null;
alexlau811 / AnimationNavigationRenderer.cs
Created Feb 25, 2015
A custom renderer to set custom animation for NavigationPage.PushAsync and NavigationPage.PopAsync on iOS with Xamarin Forms.
View AnimationNavigationRenderer.cs
[assembly: ExportRenderer(typeof(NavigationPage), typeof(AnimationNavigationRenderer))]
class AnimationNavigationRenderer : NavigationRenderer
public override void PushViewController(UIViewController viewController, bool animated)
if (animated)
// Alternative way with different set of trannsition
alexlau811 / ExtendedPageRenderer.cs
Created Feb 22, 2015
Move toolbar items with priority = 0 to LeftBarButtonItems on iOS with Xamarin Forms. Originally written by Murally at
View ExtendedPageRenderer.cs
[assembly: ExportRenderer(typeof(ContentPage), typeof(ExtendedPageRenderer))]
public class ExtendedPageRenderer : PageRenderer
public override void ViewWillAppear(bool animated)
var contentPage = this.Element as ContentPage;
if (contentPage == null || NavigationController == null)