Skip to content

Instantly share code, notes, and snippets.

View j05u3's full-sized avatar
🎯
Focusing

Josue j05u3

🎯
Focusing
View GitHub Profile
@j05u3
j05u3 / lifecycle_aware_stream_builder.dart
Last active November 7, 2022 03:07
Lifecycle aware stream builder (flutter). Find more details on https://medium.com/p/a2ae7244af32
import 'dart:async';
import 'package:flutter/widgets.dart';
abstract class StreamBuilderBase<T, S> extends StatefulWidget {
/// Creates a [StreamBuilderBase] connected to the specified [stream].
const StreamBuilderBase({ Key key, this.stream }) : super(key: key);
/// The asynchronous computation to which this builder is currently connected,
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(color: Colors.white),
child: buildHomePage("my first function")
);
}
Widget buildHomePage(String title) {
final titleText = Container(
padding: EdgeInsets.all(20),
@j05u3
j05u3 / DiffObservableList.java
Last active May 25, 2018 22:26
ObservableList to animate item movements inside a LinearLayout
package pe.tumicro.android.ui.common;
import android.databinding.ListChangeRegistry;
import android.databinding.ObservableList;
import android.support.annotation.MainThread;
import android.support.v7.util.DiffUtil;
import android.support.v7.util.ListUpdateCallback;
import java.util.AbstractList;
@j05u3
j05u3 / E.cpp
Created November 23, 2015 06:21
Solution to problem E
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
@j05u3
j05u3 / GA_TSP.cpp
Created July 23, 2015 05:28
Genetic algorithm implementation for TSP, the input is a set of 2d points. The algorithm considers that it is possible to walk between any pair of points with euclidean distance (complete graph).
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;
@j05u3
j05u3 / segmentTreeWithLazy.cpp
Created June 24, 2015 02:27
Segment Tree with Lazy Propagation, I added the LazyNode struct
// Planchota con modificaciones de Josue
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>