Skip to content

Instantly share code, notes, and snippets.

Filip Hracek filiph

Block or report user

Report or block filiph

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View twitter_50k_followers.dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
const List<List<int>> _pixels = [
[1, 1, 1, 1, 0, 0, 1, 1, 0],
[1, 0, 0, 0, 0, 1, 0, 0, 1],
[1, 1, 1, 0, 0, 1, 0, 0, 1],
[0, 0, 0, 1, 0, 1, 0, 0, 1],
@filiph
filiph / main.dart
Last active Apr 18, 2019
A functional way to capitalize each word in a sentence (a.k.a. Title Case). This is not efficient -- use something like string_scanner if you need to run this in a tight loop.
View main.dart
main() {
var city = "new york";
print(titleCase(city));
}
/// Inefficient way of capitalizing each word in a string.
String titleCase(String text) {
if (text.length <= 1) return text.toUpperCase();
var words = text.split(' ');
var capitalized = words.map((word) {
View main.dart
import 'package:flutter/material.dart';
import 'package:ring_of_circles/src/widget.dart';
/// Just the app. Nothing to see here, except the code for changing
/// the number of circles (`n`).
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@filiph
filiph / main.dart
Last active Dec 20, 2018
The starter Flutter app rewritten using ScopedModel
View main.dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:scoped_model/scoped_model.dart';
void main() {
// Initialize the model. Can be done outside a widget, like here.
var counter = Counter();
// Just because we can: wait five seconds after the start of the app ...
@filiph
filiph / main.dart
Created Nov 30, 2018
ScopedModel counter app
View main.dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:scoped_model/scoped_model.dart';
void main() {
// The app state.
final myModel = CounterModel(42);
// A timer, to simulate updates coming from outside the app.
@filiph
filiph / main.dart
Created Nov 21, 2018
Hot reload time out
View main.dart
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:sliver_fbs/src/names.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@filiph
filiph / are_we_there_yet.sh
Last active Sep 20, 2018
A script that tells you whether a commit has landed to any of the Flutter channels (`master`, `dev` and `beta`). Useful when you're waiting to use a feature or remove a workaround to a bug.
View are_we_there_yet.sh
#!/usr/bin/env bash
set -o vi
# Change this accordingly.
# You may have github.com/flutter/flutter named as "upstream".
REMOTE_NAME=origin
# The hash we search for when no argument is given.
DEFAULT_HASH=76468dd
@filiph
filiph / are_we_there_yet.sh
Created Sep 20, 2018
A script that tells you whether a commit has landed to which Flutter branch.
View are_we_there_yet.sh
#!/usr/bin/env bash
DEFAULT_HASH=76468dd
if [ -z "$1" ]
then
echo "You can provide the commit hash you're interested in as argument."
echo "Defaulting to $DEFAULT_HASH."
HASH=$DEFAULT_HASH
else
@filiph
filiph / spanify.dart
Last active Jun 1, 2017
A tool used for CSS-fading in a site without any client-side scripting
View spanify.dart
import 'dart:io';
import 'dart:math';
import 'package:html/dom.dart';
import 'package:html/parser.dart';
import 'package:markdown/markdown.dart' as md;
main(args) {
var mdSource = new File(args.single).readAsStringSync();
var html = md.markdownToHtml(mdSource);
@filiph
filiph / helloworld.dart
Created Jun 18, 2016
The smallest possible hello world program in Dart.
View helloworld.dart
main() => print("Hello World!");
You can’t perform that action at this time.