Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan chimon2000

View GitHub Profile
View as_value_listenable.dart
extension AsValueListenable<T> on Stream<T> {
/// Converts a [Stream] to a [ValueListenable]
///
/// The internal [StreamSubscription] is cancelled when
/// all listeners added to [ValueListenable] are removed.
/// Keep this in mind as this could cause issues with
/// single-subscription streams.
ValueListenable<T> asValueListenable(T initialValue) {
return _StreamValueListenable(this, initialValue);
}
@Nash0x7E2
Nash0x7E2 / Allow-multiple-gestures.dart
Last active Sep 26, 2021
[DEPRECATED] Sample code on how to enable gesture pass through so that both the parent and the child widget receive the gesture.
View Allow-multiple-gestures.dart
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
//Main function. The entry point for your Flutter app.
void main() {
runApp(
MaterialApp(
home: Scaffold(
body: DemoApp(),
),
@developit
developit / *valoo.md
Last active Jul 17, 2021
🐻 Valoo: just the bare necessities of state management. 150b / 120b. https://npm.im/valoo
View *valoo.md

🐻 valoo

just the bare necessities of state management.

Usage

Hotlink it from https://unpkg.com/valoo.

See Interactive Codepen Demo.

@addyosmani
addyosmani / workbox.md
Last active Oct 18, 2021
Workbox recipes
View workbox.md

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()
@raphaelkross
raphaelkross / Javascript Immutable Operations
Created Mar 27, 2016
Javascript Immutable Operations
View Javascript Immutable Operations
// Arrays & Objs Without Mutations
var list = ['1', '2', '3'];
var obj = {item: 1, blob: 2};
// Adds item to array
list.concat(['4', '5']);
[...list, [4, 5]];
@gorangajic
gorangajic / es6-spread-immutable-cheatsheet.md
Last active Nov 19, 2021
es6 spread immutable cheatsheet
View es6-spread-immutable-cheatsheet.md

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {
@marty-wang
marty-wang / gist:5a71e9d0a6a2c6d6263c
Last active Jul 21, 2021
Compile and deploy React Native Android app of Release version to device.
View gist:5a71e9d0a6a2c6d6263c
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"