Skip to content

Instantly share code, notes, and snippets.

View martinrybak's full-sized avatar

Martin Rybak martinrybak

  • Very Good Ventures
  • New York, NY
View GitHub Profile
@martinrybak
martinrybak / main.dart
Created March 25, 2020 15:06
Dart inheritance weirdness
class Foo {}
class Bar extends Foo {}
void acceptsBar(Bar bar) {}
void main() {
Foo foo = Foo();
acceptsBar(Foo()); // ERROR
acceptsBar(foo); // NO ERROR ??
@martinrybak
martinrybak / keyboard-avoider.dart
Created June 3, 2018 12:20
Wraps a widget in a container that adjusts its bottom padding to accommodate the on-screen keyboard
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
/// Wraps the [child] in a [Container] or [AnimatedContainer], based on [animated],
/// that adjusts its bottom padding to accommodate the on-screen keyboard.
class KeyboardAvoider extends StatefulWidget
{
/// The child contained by the widget
final Widget child;
@martinrybak
martinrybak / xcode-build-script
Last active December 22, 2015 22:39
A build script for Xcode that update build number with the last git commit count and generates appledoc documentation
#Update build number with number of git commits if in release mode
if [ ${CONFIGURATION} == "Release" ]; then
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
fi;
#if [ ${CONFIGURATION} == "Release" ]; then
APPLEDOC_PATH=`which appledoc`
if [ $APPLEDOC_PATH ]; then
$APPLEDOC_PATH \