Skip to content

Instantly share code, notes, and snippets.

View aloisdeniel's full-sized avatar
🤘
Flutter / Figma / Firebase rock!

Aloïs Deniel aloisdeniel

🤘
Flutter / Figma / Firebase rock!
View GitHub Profile
@aloisdeniel
aloisdeniel / gist:463440031a20f6f5e1e1
Last active August 29, 2015 14:18
Cloning all dependency properties of a UserControl
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 / FormatTemplate.ps1
Last active November 4, 2015 16:30
Powershell snippets - Building, packaging
## 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 / WeakEventHandler.cs
Created January 10, 2017 01:52
Weak event handlers to avoid keeping strong reference to subscriber of an event.
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 / Battery.standard.cs
Created March 8, 2018 07:40
Caboodle mock example
namespace Microsoft.Caboodle
{
public interface IBattery
{
void StartBatteryListeners();
void StopBatteryListeners();
double ChargeLevel { get; }
@aloisdeniel
aloisdeniel / SnapLayout.cs
Created June 20, 2017 14:37
Snapped Horizontal UICollectionView in Xamarin.iOS
namespace SnapCollection
{
using UIKit;
using CoreGraphics;
public class SnapLayout : UICollectionViewFlowLayout
{
public SnapLayout()
{
this.ItemSize = new CGSize(300, 250);
@aloisdeniel
aloisdeniel / build.dart
Last active April 5, 2019 04:55
Removing depdencies to flutter SDK into path_drawing
// 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() + ";")));
}
import 'dart:math';
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@aloisdeniel
aloisdeniel / stream_vs_valuelistenable.dart
Last active April 17, 2021 20:14
This example shows how, in a majority of cases, Streams cause unnecessary rebuilds in initial state.
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());

Test

Create file

pubspec.yaml

Open file

pubspec.yaml

@aloisdeniel
aloisdeniel / Solution.dart
Last active August 30, 2021 12:15
Expand padding while scroll
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(