Skip to content

Instantly share code, notes, and snippets.

View satya164's full-sized avatar
🦋
Trying…

Satyajit Sahoo satya164

🦋
Trying…
View GitHub Profile
@satya164
satya164 / casaos-export-docker-compose.sh
Last active May 3, 2024 15:55
Export Docker Compose files on CasaOS
#!/bin/bash
# This script export all docker compose files installed via CasaOS store
mkdir -p docker-compose
appids=$(casaos-cli app-management list apps | tail -n +3 | cut -d' ' -f1)
for id in $appids
do
casaos-cli app-management show local $id --yaml > docker-compose/${id}.yml
@satya164
satya164 / patch.diff
Last active November 8, 2023 16:36
Android Gradle Plugin 8 support for React Native libraries
diff --git a/android/build.gradle b/android/build.gradle
index 525cb31..6af104d 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -36,7 +36,30 @@ def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["MyLib_" + name]).toInteger()
}
+def supportsNamespace() {
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
@satya164
satya164 / quantity-query.scss
Last active September 7, 2023 20:06
Quantity Queries in Sass
@mixin quantity-query($selector, $type, $amount, $max: null) {
@if $type == at-least {
#{$selector}:nth-last-child(n+#{$amount}),
#{$selector}:nth-last-child(n+#{$amount}) ~ #{$selector} { @content; }
} @else if $type == at-most {
#{$selector}:nth-last-child(-n+#{$amount}):first-child,
#{$selector}:nth-last-child(-n+#{$amount}):first-child ~ #{$selector} { @content; }
} @else if $type == between {
@if type-of($max) != "number" {
@error "Max value must be a number for quantity-query.";
@satya164
satya164 / react-navigation-static.md
Last active January 10, 2023 21:54
React Navigation Static API

React Navigation Static API

React Navigation has a dynamic API which makes it possible to achieve advanced and use cases. But it can result in additional boilerplate and duplication. The goal of this static API is to provide a simpler API for simple use cases.

Basic API

const MyNavigation = createNavigation({
  // Type of the navigator, takes the 'createXNavigator' function from respective package
  type: createStackNavigator,
@satya164
satya164 / deep-link-conditional-rendering.md
Last active September 15, 2022 00:18
Handle deep link + auth in React Navigation
@satya164
satya164 / react-navigation-shared.md
Last active August 15, 2022 02:28
React Navigation Shared Navigator

Shared Navigator

This is a UI and router agnostic navigator that aims to make it easier to build navigators with shared transitions between screens. All it does is keep track of animations in various screens so that the UI code can focus on animations instead.

Basic API

The basic API looks like this:

const Shared = createSharedNavigator(StackRouter);
/* @flow */
/* eslint-disable no-console */
let _types: ?Array<string>,
_filters: ?Array<string | RegExp>,
_history: ?Array<{ timestamp: number; args: Array<any>; }>;
const labels = {
info: '[info]',
warn: '[warn]',
/* @flow */
import React, { PureComponent, PropTypes } from 'react';
import {
Animated,
View,
StyleSheet,
ScrollView,
} from 'react-native';
"use strict";
function Lace(selector) {
var nodes, el;
// Handle situation where called without "new" keyword
if (false === (this instanceof Lace)) {
return new Lace(selector);
}
@satya164
satya164 / KeyboardSpacer.tsx
Created December 13, 2019 12:11
Spacer component to handle keyboard show and hide
import * as React from 'react';
import { Animated, Keyboard, KeyboardEvent, Platform } from 'react-native';
type Props = {
offset?: number;
};
type State = {
keyboardHeightAnim: Animated.Value;
};