Skip to content

Instantly share code, notes, and snippets.

@JSerZANP
JSerZANP / ContentView.swift
Created March 4, 2021 14:01
communication between native(swiftUI) and wkwebview
import SwiftUI
import WebKit
struct WebView: UIViewRepresentable {
class Coordinator: NSObject, WKNavigationDelegate, WKScriptMessageHandler {
var webView: WKWebView?
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
self.webView = webView
}
@JSerZANP
JSerZANP / fiber-tree-traversal.js
Created January 16, 2022 09:51
Fiber tree traversal example
const root = {
val: 1
}
const node2 = {
val: 2,
returnNode: root
}
root.child = node2
const node3 = {
@JSerZANP
JSerZANP / thought.md
Last active March 21, 2021 01:37
[idea] alternative syntax to tailwind

semantic approach

<div class="chat-notification">
  <div class="chat-notification-logo-wrapper">
    <img class="chat-notification-logo" src="/img/logo.svg" alt="ChitChat Logo">
  </div>
  <div class="chat-notification-content">
    <h4 class="chat-notification-title">ChitChat</h4>
    <p class="chat-notification-message">You have a new message!</p>
@JSerZANP
JSerZANP / bfe.dev-1-solution.js
Created August 16, 2020 08:39
bfe.dev-1-solution.js
function curry(func) {
return function curried(...args) {
// 1. if enough args, call func
// 2. if not enough, bind the args and wait for new one
if (args.length >= func.length) {
return func.apply(this, args)
} else {
return curried.bind(this, ...args)
}
}
@JSerZANP
JSerZANP / bfe-1-example.js
Last active August 16, 2020 08:38
bfe.dev #1
const join = (a, b, c) => {
return `${a}_${b}_${c}`
}
const curriedJoin = curry(join)
curriedJoin(1, 2, 3) // '1_2_3'
curriedJoin(1)(2, 3) // '1_2_3'