Skip to content

Instantly share code, notes, and snippets.

View ozcanzaferayan's full-sized avatar
⚛️
Overreacting

Özcan Zafer AYAN ozcanzaferayan

⚛️
Overreacting
View GitHub Profile
@ozcanzaferayan
ozcanzaferayan / setupTests.ts
Created March 4, 2022 23:03
Testing react components - setupTests.ts
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom";
const unmockedFetch = global.fetch;
beforeAll(() => {
const getDataByUrl = (url: string) => {
switch (url) {
@ozcanzaferayan
ozcanzaferayan / Repos.tsx
Created March 4, 2022 22:58
Testing react components - Repos.tsx
import { useState } from "react";
type Repo = {
full_name: string;
};
function Repos() {
const [repos, setRepos] = useState<Repo[] | null>(null);
const [userName, setUserName] = useState<string>("octocat");
const getRepos = () => {
@ozcanzaferayan
ozcanzaferayan / App.test.tsx
Last active March 4, 2022 22:28
Testing react components - App.test.tsx
import { fireEvent, render, screen } from "@testing-library/react";
import App from "./App";
const unmockedFetch = global.fetch;
beforeAll(() => {
global.fetch = () =>
Promise.resolve({
json: () =>
Promise.resolve({
@ozcanzaferayan
ozcanzaferayan / App.tsx
Last active March 4, 2022 22:20
Testing React component - App.tsx
import { useState } from "react";
type User = {
name: string;
followers: string;
following: string;
};
function App() {
const [user, setUser] = useState<User | null>(null);
#import "FrameHostObject.h"
#import <Foundation/Foundation.h>
#import <jsi/jsi.h>
// This method returns all of keys
std::vector<jsi::PropNameID> FrameHostObject::getPropertyNames(jsi::Runtime& rt) {
std::vector<jsi::PropNameID> result;
result.push_back(jsi::PropNameID::forUtf8(rt, std::string("toString")));
result.push_back(jsi::PropNameID::forUtf8(rt, std::string("isValid")));
result.push_back(jsi::PropNameID::forUtf8(rt, std::string("width")));
#pragma once
#import <jsi/jsi.h>
#import <CoreMedia/CMSampleBuffer.h>
#import "Frame.h"
using namespace facebook;
class JSI_EXPORT FrameHostObject: public jsi::HostObject {
public:
@ozcanzaferayan
ozcanzaferayan / index.js
Last active January 15, 2022 10:15
Wordle en mantıklı başlangıç kelimeleri
const list = [
"abacı",
"abadi",
"abalı",
"abana",
"abani",
"abaşo",
"abaza",
"abbas",
"abdal",
@ozcanzaferayan
ozcanzaferayan / electrode-native-helloworld.md
Created November 5, 2021 13:31 — forked from hemanth-manoharan/electrode-native-helloworld.md
Tutorial #1: How to create a mini app in Electrode Native and embed it within an outer Android native app

Tutorial #1: How to create a mini app in Electrode Native and embed it within an outer Android native app

This is the first in a series of posts around Electrode Native.

Was not able to directly find a "hello world" type of guide that demonstrates all the capabilities of Electrode Native - like mini-app packaging and OTA (Over-The-Air updates) in the documentation here - https://www.electrode.io/site/docs/getting_started.html

Hence, decided to write one as part of my journey. These posts are more focused on getting the code running than on explanation of the underlying concepts. For details on the concepts, please refer to the Electrode Native documentation directly.

Note: Electrode Native version at the time of writing this tutorial - v0.45.5

@ozcanzaferayan
ozcanzaferayan / electrode-native-helloworld2.md
Created November 5, 2021 13:31 — forked from hemanth-manoharan/electrode-native-helloworld2.md
Tutorial #2: How to add the second mini app to an outer android app

Tutorial #2: How to add the second mini app to an outer android app

This post is the 2nd one in a series of posts on Electrode Native.

It assumes that one has already completed the steps in Tutorial #1 here - https://gist.github.com/hemanth-manoharan/edb363d575d5c9ab22cbc93b595b8fba

  • First, create a second mini-app and publish it to npm as we did in the previous tutorial.

Assuming that the 2nd app is named app2-miniapp

@ozcanzaferayan
ozcanzaferayan / electrode-native-helloworld3.md
Created November 5, 2021 13:21 — forked from hemanth-manoharan/electrode-native-helloworld3.md
Tutorial #3: How to perform OTA (Over-The-Air) updates using CodePush