Skip to content

Instantly share code, notes, and snippets.

@ffeu
ffeu / extract.sh
Last active October 12, 2020 12:34
Gist to document a way to add a MacOS Automator Quick Action which automatically extracts the images inside a ZIP file. This is useful when you pick and download a few images taken from iPhone from Google Photos, and instead of an Image you get a ZIP file. This will extract the images inside the ZIP file and delete the original file.
for fullpath in "$@"
do
dir="$(/usr/bin/dirname $fullpath)"
filename="${fullpath##*/}" # Strip longest match of */ from start
base="${filename%.[^.]*}" # Strip shortest match of . plus at least one non-dot char from end
ext="${filename:${#base} + 1}" # Substring from len of base thru end
if [[ -z "$base" && -n "$ext" ]]; then # If we have an extension and no base, it's really the base
base=".$ext"
ext=""
fi
@ffeu
ffeu / main.dart
Created December 13, 2018 12:35
ReorderableListSimple demo (requires flutter 1.0.0, flutter_reorderable_list 0.1.1) For ReorderableListSimple , see this gist: https://gist.github.com/ffeu/127c2b76d891fa12c9e2c831def785c4
import 'package:flutter/material.dart';
import 'reorderable_list_simple.dart';
const title = "ReorderableListSimple demo";
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
@ffeu
ffeu / reorderable_list_simple.dart
Last active February 15, 2024 03:32
An easy to replace Widget to make easier to migrate from flutter/ReorderableListView to knopp/ReorderableList . (flutter 1.0.0 and flutter_reorderable_list 0.1.1)
import 'package:flutter/material.dart';
import 'package:flutter_reorderable_list/flutter_reorderable_list.dart';
enum ReorderableListSimpleSide {Right, Left}
class ReorderableListSimple extends StatefulWidget {
ReorderableListSimple({
@required this.children,
@required this.onReorder,
this.allowReordering = true,
@ffeu
ffeu / main.dart
Last active March 1, 2020 00:18
PopupMenuItem vs ListView, ReorderableListView and ReorderableList (problem in PopupMenuItem vs ReorderableListView) (flutter 1.0.0, flutter_reorderable_list 0.1.1)
import 'package:flutter/material.dart';
import 'package:flutter_reorderable_list/flutter_reorderable_list.dart';
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<MyItem> _sampleItems;
@ffeu
ffeu / main.dart
Last active December 7, 2018 15:45
PopupMenuItem/PopupMenuButton gets misplaced when inside a ReorderableListView>ListTile (flutter 1.0.0)
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
const title = "PopupMenuButton test";
class MyItem {
MyItem(this.icon, this.title);
final IconData icon;
@ffeu
ffeu / clang-format@7.rb
Last active March 12, 2021 14:43
EDIT 2021: NOT WORKING ANYMORE!! clang-format version 7 (7.0.0) formula for brew (check comment below on how to install it)
class ClangFormatAT7 < Formula
desc "Formatting tool for C/C++/Java/JavaScript/Objective-C/Protobuf"
homepage "https://releases.llvm.org/7.0.0/tools/clang/docs/ClangFormat.html"
version "7.0.0"
if MacOS.version >= :sierra
url "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_700/final/", :using => :svn
else
url "http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_700/final/", :using => :svn
end
@ffeu
ffeu / clang-format@5.rb
Last active May 17, 2022 04:50
EDIT 2021: NOT WORKING ANYMORE!! clang-format version 5 (5.0.2) formula for brew (check comment below on how to install it)
class ClangFormatAT5 < Formula
desc "Formatting tool for C/C++/Java/JavaScript/Objective-C/Protobuf"
homepage "https://releases.llvm.org/5.0.2/tools/clang/docs/ClangFormat.html"
version "5.0.2"
if MacOS.version >= :sierra
url "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_502/final/", :using => :svn
else
url "http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_502/final/", :using => :svn
end
@ffeu
ffeu / main.dart
Created August 3, 2018 00:18
Flutter Main Example with StreamBuilder
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
@ffeu
ffeu / rip_dvd.sh
Last active November 18, 2021 13:44
rip dvd in ubuntu using mencoder
#!/bin/bash
# https://gist.github.com/ffeu/7905139fabd76e8030fa6161a12b2f6b
if [ -z "$*" ] ; then
echo "No arguments provided. Usage:"
echo ""
echo "./rip_dvd.sh <input_vob_file> <output_avi_file>"
echo ""
exit 0
fi
@ffeu
ffeu / color_picker.dart
Last active September 28, 2021 19:38
Basic Material Color Picker for Flutter
/*
Basic ColorPicker for Flutter
FFeu (https://github.com/ffeu) 2018-04
onSelected callback function can be used to detect which color was selected
OR
you can simply use a Dialog like this: