var a = 3;
print("$a 123");
print("${a+1} 123");
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 overrideCatalystScaleFactor: Void = { | |
guard let sceneViewClass = NSClassFromString("UINSSceneView") as? NSObject.Type else { | |
return | |
} | |
if sceneViewClass.instancesRespond(to: NSSelectorFromString("scaleFactor")) { | |
// old | |
swizzleInstanceMethod( | |
class: sceneViewClass, | |
originalSelector: NSSelectorFromString("scaleFactor"), | |
swizzledSelector: #selector(swizzle_scaleFactor) |
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
const jsdom = require("jsdom"); | |
const { JSDOM } = jsdom; | |
const fs = require("fs"); | |
const files = [ | |
"202012.html", | |
"202111.html", | |
"202112.html", | |
"202201.html", | |
"202202.html", |
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 GlobalSpinner from '@/components/GlobalSpinner' | |
import { contextFactory } from './helpers/contextFactory' | |
import { useToggleState } from '@/hooks/useToggleState' | |
type GlobalSpinnerContextProviderProps = { | |
children: React.ReactNode | |
} | |
const GlobalSpinnerContextProvider = ( | |
props: GlobalSpinnerContextProviderProps |
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 { createContext, useContext } from 'react' | |
export const contextFactory = <A extends unknown | null>() => { | |
const context = createContext<A | undefined>(undefined) | |
const useCtx = () => { | |
const ctx = useContext(context) | |
if (ctx === undefined) { | |
throw new Error('useContext must be used inside of a Provider with a value.') | |
} | |
return ctx |
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 { FunctionComponent } from "react"; | |
import styled, { keyframes, css } from "styled-components"; | |
const SkeletonLoader: FunctionComponent<{ | |
isLoading?: boolean; | |
}> = (props) => { | |
return ( | |
<Content isLoading={props.isLoading}> | |
{props.isLoading && <Loader />} | |
{props.children} |
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
// use after view has been layout | |
extension UIView | |
{ | |
// different inner shadow styles | |
public enum innerShadowSide | |
{ | |
case all, left, right, top, bottom, topAndLeft, topAndRight, bottomAndLeft, bottomAndRight, exceptLeft, exceptRight, exceptTop, exceptBottom | |
} | |
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
class GradientView: UIView { | |
var gradientLayer: CAGradientLayer { | |
return layer as! CAGradientLayer | |
} | |
override class var layerClass: AnyClass { | |
return CAGradientLayer.self | |
} | |
} |
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 UIKit | |
class ViewController: UIViewController { | |
var textField: UITextField! | |
var textView: UITextView! | |
private let maxLength = 20 | |
override func viewDidLoad() { | |
super.viewDidLoad() |
NewerOlder