Skip to content

Instantly share code, notes, and snippets.

View jackyhieu1211-hn's full-sized avatar

jackyhieu1211 jackyhieu1211-hn

View GitHub Profile
@horeaporutiu
horeaporutiu / demoContract.js
Last active July 9, 2023 11:40
a Hyperleger Smart Contract that is able to retrieve the history of updates for a certain key
'use strict';
const { Contract } = require('fabric-contract-api');
class MyContract extends Contract {
//add a member along with their email, name, address, and number
async addMember(ctx, email, name, address, phoneNumber) {
let member = {
name: name,
address: address,
@andreidiaconu
andreidiaconu / main.dart
Last active March 25, 2021 01:02
Code demonstrating how you can keep your ExpansionTile widgets expanded when you set a new state and replace the data. The key is to generate the keys that ExpansionTile uses from attributes of your data that are unique. Code to focus on is line 105. Original question was asked here https://stackoverflow.com/questions/50087222/prevent-expansiont…
import 'package:flutter/material.dart';
class ExpansionTileSample extends StatefulWidget {
@override
ExpansionTileSampleState createState() {
return new ExpansionTileSampleState();
}
}
class ExpansionTileSampleState extends State<ExpansionTileSample> {
@NikolaDespotoski
NikolaDespotoski / SwipeRefreshLayoutToggleScrollListener
Created November 27, 2014 15:19
Fix for known bug when scrolling a RecyclerView inside SwipeRefreshLayout to the top and refresh is called prematurely, before the first item is shown.
public class SwipeRefreshLayoutToggleScrollListener extends RecyclerView.OnScrollListener {
private List<RecyclerView.OnScrollListener> mScrollListeners = new ArrayList<RecyclerView.OnScrollListener>();
private int mExpectedVisiblePosition = 0;
private SwipeRefreshLayout mSwipeLayout;
public SwipeRefreshLayoutToggleScrollListener(SwipeRefreshLayout swipeLayout) {
mSwipeLayout = swipeLayout;
}
public void addScrollListener(RecyclerView.OnScrollListener listener){
mScrollListeners.add(listener);