Skip to content

Instantly share code, notes, and snippets.

View IslamRustamov's full-sized avatar
😜
Popping outta wagon escootit

Islam IslamRustamov

😜
Popping outta wagon escootit
  • Krasnodar, Russia
View GitHub Profile
import React, { useEffect } from 'react';
import { ActivityIndicator, Dimensions, Image, StyleSheet, View } from 'react-native';
import { PanGestureHandler } from 'react-native-gesture-handler';
import Animated, {
Extrapolate,
Extrapolation,
interpolate,
runOnJS,
useAnimatedGestureHandler,
useAnimatedStyle,
std::vector<int> NativeSampleModule::sort(jsi::Runtime& rt, std::vector<int> input) {
int i = 0;
int j = 0;
int temp = 0;
std::vector<int> foo = input;
for(i = 0; i < foo.size(); i++) {
for(j = 0; j < foo.size() - 1; j++) {
if(foo[j + 1] < foo[j]) {
- (void)sort:(NSMutableArray *)arr resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
NSMutableArray <NSNumber *>*foo = [[NSMutableArray alloc] initWithArray:arr copyItems:YES];
for (int i = 0; i < [foo count]; i++) {
for (int j = 0; j < [foo count] - 1; j++) {
if (foo[j + 1].integerValue < foo[j].integerValue) {
NSInteger a = foo[j].integerValue;
foo[j] = foo[j + 1];
foo[j + 1] = @(a);
}
private func sort(result: FlutterResult, _ array: [Int]) {
var arr = array
for _ in 0...arr.count {
for value in 1...arr.count - 1 {
if arr[value-1] > arr[value] {
let largerValue = arr[value-1]
arr[value-1] = arr[value]
arr[value] = largerValue
}
}
const sortCPP = arr => {
let mean = 0;
for (let i = 0; i < 1000; i++) {
const startTime = performance.now();
NativeSampleModule.sort(arr);
const endTime = performance.now();
const sortObjectiveC = async arr => {
let mean = 0;
for (let i = 0; i < 1000; i++) {
const startTime = performance.now();
await RTNSorter?.sort(arr);
const endTime = performance.now();
Future<void> _sort() async {
try {
double mean = 0;
for (var i = 0; i < 1000; i++) {
final stopwatch = Stopwatch()..start();
await platform.invokeMethod('sort', list10);
stopwatch.stop();
// Don't worry, I converted it to milliseconds afterwards
interface Article {
title: string;
date: string;
}
// ...
interface ArticleBlockProps extends Article {
isCenter: boolean;
}
const height = Dimensions.get('window').height;
const blockSize = 70;
function ItemSeparator() {
return <View style={{height: 10}} />;
}
function ListSpacer() {
return <View style={{height: height / 2 - blockSize}} />;
setCenteredIndex(Math.round(e.nativeEvent.contentOffset.y / blockSize));