Skip to content

Instantly share code, notes, and snippets.

Diego Ponce de León xleon

Block or report user

Report or block xleon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Ejemplo simple de calculadora para IVA e IRPF dada una base imponible
from colorama import init, Fore, Back, Style
xleon /
Last active Jan 31, 2018 — forked from magopian/
Django admin command to "fix permissions" (create them properly for proxy models).This is needed because of the following bug in Django (not fixed as of 1.6):
# -*- coding: utf-8 -*-
"""Add permissions for proxy model.
This is needed because of the bug
in Django (as of 1.6, it's not fixed).
When a permission is created for a proxy model, it actually creates if for it's
base model app_label (eg: for "article" instead of "about", for the About proxy
What we need, however, is that the permission be created for the proxy model
itself, in order to have the proper entries displayed in the admin.
View ScrollAwareFloatingAactionButtonBehavior.cs
using Android.Content;
using Android.Support.Design.Widget;
using Android.Support.V4.View;
using Android.Util;
using Android.Views;
using Java.Interop;
namespace Droid.Helpers
public class ScrollAwareFloatingAactionButtonBehavior : CoordinatorLayout.Behavior
xleon /
Last active Sep 30, 2016
Write bytes to a FileStream in async mode and close stream when finished
package lba.utils
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.utils.ByteArray;
import org.osflash.signals.Signal;
xleon /
Last active Aug 10, 2016
Service Locator for ActionScript applications
package Core.Utils.ServiceLocation
public interface ILocator
function RegisterConstant(value:Object, type:Class):void;
function Register(type:Class, contract:Class = null):void;
function RegisterSingleton(type:Class, contract:Class = null):void;
xleon / AutoScrollFromKeyboard.cs
Created Apr 1, 2016
Scroll Content when soft keyboard appears/disappears in iOS UIViewController
View AutoScrollFromKeyboard.cs
using System;
using CoreGraphics;
using Foundation;
using HakiOS.Ui.Extensions;
using UIKit;
// adapted from
namespace HakiOS.Ui.Utils
public class AutoScrollFromKeyboard
xleon / Pre-build event (Visual Studio)
Last active Feb 20, 2016
PowerShell script to update iOS bundle (Info.pslist) depending on the build configuration. This way you can target different identifiers/display names and have them all installed in the same device
View Pre-build event (Visual Studio)
PowerShell -File "$(ProjectDir)Update-Bundle.ps1" $(ProjectDir) $(ConfigurationName)
xleon / ExifRotation.cs
Last active Jun 26, 2019
Exif rotation fix (Android Xamarin) borrowed from mvvmcross
View ExifRotation.cs
using Android.Graphics;
using Android.Media;
private static Bitmap ExifRotateBitmap(string filePath, Bitmap bitmap)
if (bitmap == null)
return null;
var exif = new ExifInterface(filePath);
var rotation = exif.GetAttributeInt(ExifInterface.TagOrientation, (int)Orientation.Normal);
xleon / CustomAndroidApplication.cs
Last active Jan 21, 2016
Custom Android Application class to know when the app is in the background
View CustomAndroidApplication.cs
using System;
using Acr.UserDialogs;
using Android.App;
using Android.Content;
using Android.Content.Res;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Plugin.CurrentActivity;
xleon / ExtendedSearchBarRenderer.cs
Created Feb 25, 2015
Xamarin.Forms renderer to hide the "Cancel" button of a SearchBar on iOS
View ExtendedSearchBarRenderer.cs
using System;
using Xamarin.Forms.Platform.iOS;
using Xamarin.Forms;
using UIKit;
using System.Diagnostics;
[assembly: ExportRenderer(typeof(SearchBar), typeof(Namespace.iOS.Renderers.ExtendedSearchBarRenderer))]
namespace Namespace.iOS.Renderers
You can’t perform that action at this time.