Skip to content

Instantly share code, notes, and snippets.

View xrigau's full-sized avatar
:shipit:
🚀

Xavi Rigau xrigau

:shipit:
🚀
View GitHub Profile
#!/bin/bash
# From: https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
export DEBIAN_FRONTEND=noninteractive
echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
sudo apt-get update
sudo apt-get install \
apt-transport-https \
@xrigau
xrigau / to_do_list_page.dart
Created April 16, 2018 16:18
Introduction to Redux in Flutter (to_do_list_page.dart viewmodel)
class _ViewModel {
final String pageTitle;
final List<_ItemViewModel> items;
final Function onNewItem;
final String newItemToolTip;
_ViewModel(this.pageTitle, this.items, this.onNewItem, this.newItemToolTip, this.newItemIcon);
factory _ViewModel.create(Store<AppState> store) {
List<_ItemViewModel> items = store.state.toDos
@xrigau
xrigau / reducer.dart
Created April 16, 2018 16:17
Introduction to Redux in Flutter (reducer.dart)
AppState appReducer(AppState state, action) => AppState(toDoListReducer(state.toDos, action), listStateReducer(state.listState, action));
final Reducer<List<ToDoItem>> toDoListReducer = // Boilerplate ignored
final Reducer<ListState> listStateReducer = combineReducers<ListState>([
TypedReducer<ListState, DisplayListOnlyAction>(_displayListOnly),
TypedReducer<ListState, DisplayListWithNewItemAction>(_displayListWithNewItem),
]);
ListState _displayListOnly(ListState listState, DisplayListOnlyAction action) => ListState.listOnly;
@xrigau
xrigau / to_do_list_page.dart
Created April 16, 2018 16:17
Introduction to Redux in Flutter (to_do_list_page.dart)
class ToDoListPage extends StatelessWidget {
@override
Widget build(BuildContext context) => StoreConnector<AppState, _ViewModel>(
converter: (Store<AppState> store) => _ViewModel.create(store),
builder: (BuildContext context, _ViewModel viewModel) => Scaffold(
appBar: AppBar(
title: Text(viewModel.pageTitle),
),
body: ListView(children: viewModel.items.map((_ItemViewModel item) => _createWidget(item)).toList()),
floatingActionButton: FloatingActionButton(
@xrigau
xrigau / state.dart
Created April 16, 2018 16:16
Introduction to Redux in Flutter (state.dart)
class AppState {
final List<ToDoItem> toDos;
final ListState listState;
AppState(this.toDos, this.listState);
factory AppState.initial() => AppState(List.unmodifiable([]), ListState.listOnly);
}
enum ListState {
@xrigau
xrigau / main.dart
Created April 16, 2018 16:16
Introduction to Redux in Flutter (main.dart)
void main() => runApp(ToDoListApp());
class ToDoListApp extends StatelessWidget {
final Store<AppState> store = Store<AppState>(
appReducer, /* Function defined in the reducers file */
initialState: AppState.initial(),
middleware: createStoreMiddleware(),
);
@override
@xrigau
xrigau / actions.dart
Last active April 16, 2018 16:18
Introduction to Redux in Flutter (actions.dart)
class DisplayListWithNewItemAction {}
@xrigau
xrigau / genesis_public_key
Created February 22, 2018 10:27
genesis_public_key
048065b862d831ce6162907fd624ecdf97a91ea30a19a327263d19e2bb687812d2450bfc639ae6ab5d453c14e112869cbc6b8aa972890a6c6b854fd3c6938b3db5
@xrigau
xrigau / versionizer.gradle
Created March 7, 2017 15:37
Version using gradle properties file
def versionFile = project.file("version.properties")
Version version = Version.read(versionFile)
ext {
versionizerVersionCode = version.code
versionizerVersionName = version.name
}
task incrementVersionForRelease << {
group = 'release'
@xrigau
xrigau / brew config
Created July 6, 2016 08:27
Problem with brew
⋊> /u/local on master brew config 10:25:11
HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: ca005cb8245e7e12ad808d78d49bce3953e1153c
Last commit: 65 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 351775d67b2e8145ac665e53ea467cff894473fa
Core tap last commit: 5 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local