Skip to content

Instantly share code, notes, and snippets.

View maks's full-sized avatar

Maksim Lin maks

View GitHub Profile
@maks
maks / main.dart
Created June 23, 2020 22:23
Flutter Day
import 'dart:async';
import 'package:flutter/material.dart';
void main() {
runApp(FlagCircle());
}
class FlagCircle extends StatefulWidget {
@override
@maks
maks / container_color_finder.dart
Created February 18, 2020 00:00
Flutter widget test "Container by Colour" finder
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
class ContainerByColorFinder extends MatchFinder {
ContainerByColorFinder(this.color, {bool skipOffstage = true})
: super(skipOffstage: skipOffstage);
final Color color;
@override
@maks
maks / pre-push
Last active October 22, 2020 10:41 — forked from miquelbeltran/pre-push
Flutter pre-push hook that runs analyze and test
#!/bin/sh
# To use add to `.git/hooks/`
# Should be named `pre-push`
# Make executable with `chmod +x`
# ref: https://gist.github.com/maks/edb25da8706cb04f45ebfdd278d91791
# run Flutter analyze + test
flutter analyze
if [ $? -ne 0 ]; then
echo 'cannot push: Flutter analyze failed'
@maks
maks / foo.txt
Created December 20, 2019 04:22
test
‎‎​
@maks
maks / main.dart
Created December 10, 2019 05:37
dart extensions in dartpad
enum DROID { R2D2, C3PO }
Expando<bool> _hasDSPlans = Expando<bool>();
extension REBELS on DROID {
bool get hasDSPlans => _hasDSPlans[this];
set givePlans(v) => _hasDSPlans[this] = v;
}
@maks
maks / connection_check.dart
Last active August 6, 2019 22:57
Flutter Widget that reacts to connectivity state
import 'package:connectivity/connectivity.dart';
import 'package:flutter/material.dart';
class ConnectivityCheck extends StatelessWidget {
final Widget child;
ConnectivityCheck({@required this.child});
@override
Widget build(BuildContext context) {
@maks
maks / mkgif.sh
Last active May 3, 2019 01:50
make GIFs out of videos
#!/bin/sh
# args: start-time length video-file
# ref: https://engineering.giphy.com/how-to-make-gifs-with-ffmpeg/
ffmpeg -ss $1 -t $2 -i $3 -filter_complex "[0:v] palettegen" /tmp/palette.png
ffmpeg -ss $1 -t $2 -i $3 -i /tmp/palette.png -filter_complex "[0:v][1:v] paletteuse" $3.gif
@maks
maks / AndroidManifest.xml
Created April 4, 2019 07:38 — forked from erkattak/AndroidManifest.xml
Android Application Setup for use with Charles Proxy
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config">
@maks
maks / keybindings.json
Created January 6, 2019 01:30
minimal vscode keybinding customisation to make it bit more like Android Studio
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+alt+left",
"command": "workbench.action.navigateBack"
},
{
"key": "ctrl+alt+-",
"command": "-workbench.action.navigateBack"
},
@maks
maks / tig-cheatsheet.md
Last active March 14, 2019 23:01
Tig Stuff

Tig CheatSheet

  • tig
  • tig status Status
  • tig blame FILE Blame
  • tig master Show a branch
  • tig test..master Show difference between two branches
  • tig FILE Show history of file
  • tig v0.0.3:README Show contents of file in a specific revision