Skip to content

Instantly share code, notes, and snippets.

Avatar
🤘
Flutter / Figma / Firebase rock!

Aloïs Deniel aloisdeniel

🤘
Flutter / Figma / Firebase rock!
View GitHub Profile
@aloisdeniel
aloisdeniel / stream_vs_valuelistenable.dart
Last active Apr 12, 2020
This example shows how, in a majority of cases, Streams cause unnecessary rebuilds in initial state.
View stream_vs_valuelistenable.dart
import 'package:flutter/material.dart';
import 'package:rxdart/rxdart.dart';
// Global application configuration and navigation
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(home: Home());
@aloisdeniel
aloisdeniel / build.dart
Last active Apr 5, 2019
Removing depdencies to flutter SDK into path_drawing
View build.dart
// Example of using parsed command to generate flutter code
var result = List<Code>();
final SvgPathStringSource parser = new SvgPathStringSource(svg);
final SvgPathNormalizer normalizer = new SvgPathNormalizer();
var segments = parser.parseSegments();
for (PathSegmentData seg in segments) {
result.addAll(normalizer.emitSegment(seg).map((c) => Code(_generateCommand(c).toString() + ";")));
}
View Battery.standard.cs
namespace Microsoft.Caboodle
{
public interface IBattery
{
void StartBatteryListeners();
void StopBatteryListeners();
double ChargeLevel { get; }
@aloisdeniel
aloisdeniel / flutter_spanablegrid.dart
Last active Jul 4, 2020
Custom GridView with various cell sizes in Flutter
View flutter_spanablegrid.dart
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/src/rendering/sliver.dart';
import 'package:flutter/src/rendering/sliver_grid.dart';
class _CoordinateOffset {
final double main, cross;
_CoordinateOffset(this.main, this.cross);
}
@aloisdeniel
aloisdeniel / SnapLayout.cs
Created Jun 20, 2017
Snapped Horizontal UICollectionView in Xamarin.iOS
View SnapLayout.cs
namespace SnapCollection
{
using UIKit;
using CoreGraphics;
public class SnapLayout : UICollectionViewFlowLayout
{
public SnapLayout()
{
this.ItemSize = new CGSize(300, 250);
@aloisdeniel
aloisdeniel / WeakEventHandler.cs
Created Jan 10, 2017
Weak event handlers to avoid keeping strong reference to subscriber of an event.
View WeakEventHandler.cs
namespace Utils
{
using System;
using System.Collections.Generic;
using System.Reflection;
/// <summary>
/// Weak event handlers to avoid keeping strong reference to subscriber of an event.
/// </summary>
public static class WeakEventHandlers
@aloisdeniel
aloisdeniel / FormatTemplate.ps1
Last active Nov 4, 2015
Powershell snippets - Building, packaging
View FormatTemplate.ps1
## Example call : & .\FormatTemplate.ps1 "test.txt" "out.txt" "1=TEST" , "other=128" ,"things=ok" , "unfound=o"
param
(
[string]$gfileIn,
[string]$gfileOut,
[string[]]$gvalues
)
## Replaces all mustache like occurences ("{{ key }}") in $fileIn content, with $values corresponding values and saves
@aloisdeniel
aloisdeniel / gist:463440031a20f6f5e1e1
Last active Aug 29, 2015
Cloning all dependency properties of a UserControl
View gist:463440031a20f6f5e1e1
namespace App1
{
using System;
using System.Linq;
using Windows.UI.Xaml.Controls;
using System.Reflection;
using Windows.UI.Xaml;
using System.Collections.Generic;
public static class UserControlExtensions
@aloisdeniel
aloisdeniel / Animation Fade
Last active Jun 3, 2020
Xamarin.iOS view common animations
View Animation Fade
public static void Fade (this UIView view, bool isIn, double duration = 0.3, Action onFinished = null)
{
var minAlpha = (nfloat)0.0f;
var maxAlpha = (nfloat)1.0f;
view.Alpha = isIn ? minAlpha : maxAlpha;
view.Transform = CGAffineTransform.MakeIdentity ();
UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut,
() => {
view.Alpha = isIn ? maxAlpha : minAlpha;
You can’t perform that action at this time.