Skip to content

Instantly share code, notes, and snippets.

View chimon2000's full-sized avatar

Ryan chimon2000

View GitHub Profile
@gorangajic
gorangajic / es6-spread-immutable-cheatsheet.md
Last active April 11, 2024 08:32
es6 spread immutable cheatsheet

update object

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

var newState = {
@marty-wang
marty-wang / gist:5a71e9d0a6a2c6d6263c
Last active February 13, 2024 07:34
Compile and deploy React Native Android app of Release version to device.
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"
@addyosmani
addyosmani / workbox.md
Last active January 20, 2024 16:14
Workbox recipes

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()
@developit
developit / *valoo.md
Last active November 13, 2023 08:39
🐻 Valoo: just the bare necessities of state management. 150b / 120b. https://npm.im/valoo

🐻 valoo

just the bare necessities of state management.

Usage

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

See Interactive Codepen Demo.

@Nash0x7E2
Nash0x7E2 / Allow-multiple-gestures.dart
Last active November 3, 2023 08:56
[DEPRECATED] Sample code on how to enable gesture pass through so that both the parent and the child widget receive the gesture.
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(),
),
@chimon2000
chimon2000 / main.dart
Created November 1, 2023 17:55
tangled-marble-2871
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final testStreamProvider = StreamProvider<int>((ref) {
return Stream.periodic(const Duration(seconds: 2), (count) {
return count;
});
});
@bizz84
bizz84 / iOS-Podfile
Last active October 12, 2023 08:40
iOS Podfile template for Flutter apps
# Set the platform at the top
platform :ios, '13.0'
# Rest of the pod file
# Update post_install step
post_install do |installer|
# Ensure pods use the minimum deployment target set above
# https://stackoverflow.com/a/64385584/436422
pods_project = installer.pods_project
@raphaelkross
raphaelkross / Javascript Immutable Operations
Created March 27, 2016 05:18
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]];
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);
}