Skip to content

Instantly share code, notes, and snippets.

View DaDude's full-sized avatar
💣
If at first you don't succeed... Blow it up again!

DaDude

💣
If at first you don't succeed... Blow it up again!
  • Germany
View GitHub Profile
@DaDude
DaDude / ImageEx.cs
Created November 1, 2018 20:21 — forked from Jyosua/ImageEx.cs
Xamarin.Forms Image subclass that finds the aspect needed to fill the view in one axis, and then dynamically expands the view in the other axis to fit the image without scaling.
public class ImageEx : Image
{
public static readonly BindableProperty TrueAspectProperty =
BindableProperty.Create(
propertyName: nameof(TrueAspect),
returnType: typeof(AspectEx),
declaringType: typeof(AspectEx),
defaultValue: AspectEx.AspectFit,
defaultBindingMode: BindingMode.OneWay,
propertyChanged: OnAspectExPropertyChanged);
@DaDude
DaDude / app.py
Created June 5, 2017 09:29 — forked from rduplain/app.py
Plot a PNG using matplotlib in a web request, using Flask.
"Plot a PNG using matplotlib in a web request, using Flask."
# Install dependencies, preferably in a virtualenv:
#
# pip install flask matplotlib
#
# Run the development server:
#
# python app.py
#
@DaDude
DaDude / flaskplotlib.py
Created June 5, 2017 09:02 — forked from wilsaj/flaskplotlib.py
Example of rendering a matplotlib image directly to Flask view
from flask import Flask, make_response
app = Flask(__name__)
@app.route("/simple.png")
def simple():
import datetime
import StringIO
import random
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas