This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getRandomSamplesByCount<T>(arr: T[], count: number) { | |
const randomSamples = []; | |
const inputCopy = arr.slice(); | |
for (let i = 0; i < count; i++) { | |
if (inputCopy.length === 0) break; | |
const randomIndex = Math.floor(Math.random() * inputCopy.length); | |
const [randomSample] = inputCopy.splice(randomIndex, 1) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useRef } from 'react'; | |
import { Animated, Button, StyleSheet, View, useWindowDimensions } from 'react-native'; | |
const half = (v: number) => Math.floor(v / 2); | |
export function ChatContainer() { | |
const { height, width } = useWindowDimensions(); | |
const animRef = useRef(new Animated.Value(0)); | |
const ballRef = useRef<View>(null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from 'react'; | |
import { NativeModules, NativeEventEmitter, EmitterSubscription, Button } from 'react-native'; | |
const { Yodo1MASAds } = NativeModules; | |
const Constants = { | |
EVENT_NAME: 'yodo1ad', | |
INIT_SUCCESS: 'init-success', | |
INIT_FAILURE: 'init-failure', | |
REWARD_LOAD_SUCCESS: 'reward-load-success', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bhoos.sdk; | |
import android.app.Activity; | |
import androidx.annotation.NonNull; | |
import androidx.annotation.Nullable; | |
import com.facebook.react.bridge.Arguments; | |
import com.facebook.react.bridge.Promise; | |
import com.facebook.react.bridge.ReactApplicationContext; | |
import com.facebook.react.bridge.ReactContextBaseJavaModule; | |
import com.facebook.react.bridge.ReactMethod; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <React/RCTBridgeModule.h> | |
#import <React/RCTEventEmitter.h> | |
#import <Yodo1MasCore/Yodo1Mas.h> | |
NSString * const EVENT_NAME = @"yodo1ad"; | |
NSString * const INIT_SUCCESS = @"init-success"; | |
NSString * const INIT_FAILURE = @"init-failure"; | |
NSString * const REWARD_LOAD_SUCCESS = @"reward-load-success"; | |
NSString * const REWARD_LOAD_FAILURE = @"reward-load-failure"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Job = { | |
id: string; | |
salary: number; | |
title: string; | |
} | |
interface User { | |
id: string; | |
name: string; | |
company: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Expo SDK40 | |
// expo-blur: ~8.2.2 | |
// expo-haptics: ~8.4.0 | |
// react-native-gesture-handler: ~1.8.0 | |
// react-native-reanimated: ^2.0.0-rc.0 | |
// react-native-safe-area-context: 3.1.9 | |
import React, { useState } from 'react'; | |
import { | |
Image, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*. useEvent hook | |
* | |
* @example | |
const { dispatch, on, events } = useEvents(); | |
useEffect(() => on('MyEvent', (data) => { ...do something...})); | |
*/ | |
const events = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let regex; | |
/* matching a specific string */ | |
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello" | |
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO" | |
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes... | |
/* wildcards */ | |
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo" | |
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo" |
NewerOlder