Skip to content

Instantly share code, notes, and snippets.

View sachaarbonel's full-sized avatar
👨‍💻
Uncovering bugs

Sacha Arbonel sachaarbonel

👨‍💻
Uncovering bugs
View GitHub Profile
@brianegan
brianegan / undo_change_notifier.dart
Created March 5, 2020 12:32
ChageNotifier with Undo/Redo functionality
import 'package:flutter/cupertino.dart';
class UndoChangeNotifier<T> extends ChangeNotifier {
List<T> _history;
int _historyIndex;
UndoChangeNotifier([T initialState]) {
_history = initialState != null ? [initialState] : [];
_historyIndex = initialState != null ? 0 : -1;
}
@lukepighetti
lukepighetti / styles.dart
Last active March 4, 2020 01:58
Extensions to get a project started
import 'package:flutter/material.dart';
class AppStyle {
static double get paddingUnit => 16;
static TextStyle get text28 => TextStyle(fontSize: 28).withTightSpacing;
static TextStyle get text20 => TextStyle(fontSize: 20).withTightSpacing;
static TextStyle get text16 => TextStyle(fontSize: 16).withNormalSpacing;
static TextStyle get text14 => TextStyle(fontSize: 14).withNormalSpacing;
static TextStyle get text12 => TextStyle(fontSize: 12).withWideSpacing;
@jogboms
jogboms / main.dart
Last active November 17, 2021 12:27
Neon Glow Graph
import 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
const kBarWidth = 72.0;
const kBarSpacing = 4.0;
const kLabelHeight = 32.0;
@natowi
natowi / audio2midi.md
Last active March 22, 2025 00:41
List of open source audio to midi packages
@mosheduminer
mosheduminer / dropzone.dart
Created December 24, 2019 12:51
Implementation of a drag-and-drop zone for flutter web. Inspired by https://gist.github.com/PlugFox/ffe83a91ce50f9c78a5b1d6674e36d1b
import 'dart:async';
import 'dart:html';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
enum _DragState {
dragging,
notDragging,
}
@lukepighetti
lukepighetti / platform_implementations.dart
Last active October 3, 2019 12:49
An idea for "federated" platform packages that gives more power to platform specific packages while still allowing them to provide a consistent API that could be fit easily into an intersection package.
/// Given some `dart:io` method that returns a PlatformType enum
PlatformType get currentPlatform => PlatformType.windows;
enum PlatformType { android, fuschia, iOS, linux, macOS, windows }
/// Intersection package, ie `video_player` exposes a common interface
abstract class PlatformVideoController {
Stream<double> get progress;
Future<void> play();
Future<void> pause();
}
@slightfoot
slightfoot / page_turn.dart
Created September 9, 2019 21:28
Page Turn Effect - By Simon Lightfoot. Replicating this behaviour. https://www.youtube.com/watch?v=JqvtZwIJMLo
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@jonico
jonico / docker-build-publish.yaml
Created August 19, 2019 07:22
Build docker image and push to GPR with GitHub Actions
name: Build and publish Jekyll Docker image for Octocat Generator
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: clean up, docker login && docker build && docker push
@nbsdx
nbsdx / mod.rs
Created August 7, 2019 05:24
chacha20 stream wrapper
use crypto::chacha20::ChaCha20;
use crypto::symmetriccipher::SynchronousStreamCipher;
use std::io::prelude::*;
// Typedefs
type ReadResult = std::io::Result<usize>;
type WriteResult = std::io::Result<usize>;
type FlushResult = std::io::Result<()>;
@jesster2k10
jesster2k10 / Activity.ts
Last active May 29, 2024 15:00
Node.js Social Activity Stream
import {
Entity,
PrimaryGeneratedColumn,
Column,
ManyToOne,
BaseEntity,
} from 'typeorm'
import { Profile } from 'entities'
import { ActivityTargetType, ActivityVerb } from './enums'