Skip to content

Instantly share code, notes, and snippets.

View hemantasapkota's full-sized avatar

Hemanta Sapkota hemantasapkota

View GitHub Profile
@hemantasapkota
hemantasapkota / chatwoot-widget.tsx
Last active November 14, 2024 21:42
Chatwoot React Native Widget Loading Indicator Fix
import React, {useMemo, useState} from 'react';
import {StyleSheet, Linking, Text, View} from 'react-native';
import {isJsonString, storeHelper, generateScripts, getMessage} from './utils';
import {WebView} from 'react-native-webview';
export interface ChatWootWidgetProps {
websiteToken: string;
locale?: string;
baseUrl: string;
cwCookie: string;
@hemantasapkota
hemantasapkota / ReactNativeAccordion.tsx
Created June 6, 2024 22:37
Animating the Accordion in React Native
import {LucideChevronDown, LucideChevronUp} from 'lucide-react-native';
import React, {useCallback, useImperativeHandle, useState } from 'react';
import {
StyleSheet,
Text,
View,
Animated,
LayoutAnimation,
Platform,
UIManager,
Property Value Description
width 800 Image width
height 600 Image height
samples_per_pixel 128 Pixel sampling rate
max_depth 50 Maximum depth for ray tracing
sky.texture "data/beach.jpg" Sky texture file
camera.look_from {x: -2.0, y: 0.5, z: 1.0} Camera origin
camera.look_at {x: 0.0, y: 0.0, z: -1.0} Point where the camera is looking
camera.vup {x: 0.0, y: 1.0, z: 0.0} Camera's up vector
import turtle
bot=turtle.Turtle()
bot.width(8)
bot.color("white")
new=turtle.Screen()
bot.speed(100)
new.bgcolor("lightgreen")
;; Arithmetic procedues
;; compute 2 + 3 and print
(format t "~A" (+ 2 6))
;; print newline
(format t "~%")
;; compute 2 - 3 and print
(format t "~A~%" (- 2 3))
import { NativeModules } from 'react-native';
export const Component = () => (
<Button onPress={() => {
NativeModules.Commander.postCommand(
{ 'command': 'load_notifications' },
(data) => { Alert.alert("Login Success"); },
(error) => { Alert.alert(error); } )}
</Button>
)
Verifying my Blockstack ID is secured with the address 1A1ZhDQAEE3gkpVgd3hXM7nVT6Kn4wFVkU https://explorer.blockstack.org/address/1A1ZhDQAEE3gkpVgd3hXM7nVT6Kn4wFVkU

Keybase proof

I hereby claim:

  • I am hemantasapkota on github.
  • I am lexsapkota (https://keybase.io/lexsapkota) on keybase.
  • I have a public key ASCuIYu_-KxT4531sTL8YqtIvAbUPutCsdZN-0XnqUaCKQo

To claim this, I am signing this object:

@hemantasapkota
hemantasapkota / CommandPackage.java
Last active July 20, 2018 02:27
CommandPackage
public class CommandPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<NativeModule>();
modules.add(new CommanderModule(reactContext));
return modules;
}
@Override