Skip to content

Instantly share code, notes, and snippets.

View sergeyshalnov's full-sized avatar
💽
Disco

Sergey Shalnov sergeyshalnov

💽
Disco
View GitHub Profile
@Saadnajmi
Saadnajmi / Ripple.tsx
Created December 29, 2024 06:31
Ripple Effect Shader with react-native-skia
import { Canvas, Circle, Group, Rect, Shader, Skia, useClock, RuntimeShader, SkRuntimeEffect, RoundedRect } from "@shopify/react-native-skia";
import { SafeAreaView, StyleSheet } from "react-native";
import { useDerivedValue, useSharedValue } from "react-native-reanimated";
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler';
const styles = StyleSheet.create({
centered: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
@p69
p69 / raydium_pool_info.ts
Created February 25, 2024 22:21
Raydium - get all pool info by pool id
async function getPoolInfo(connection: Connection, poolId: PublicKey): Promise<ApiPoolInfoV4> {
const info = await connection.getAccountInfo(poolId);
if (!info) {
throw error('No Pool Info')
}
let amAccountData = { id: poolId, programId: info.owner, ...LIQUIDITY_STATE_LAYOUT_V4.decode(info.data) }
const marketProgramId = amAccountData.marketProgramId
const allMarketInfo = await connection.getAccountInfo(marketProgramId)
if (!allMarketInfo) {
@alexwidua
alexwidua / ContentView.swift
Created July 4, 2023 17:07
SwiftUI Grid Animation
import SwiftUI
// 1. Use looped H/VStacks to create a grid
// 2. Conditionally increase spacing to grow/shrink the grid
// 3. Calculate the distance of each dot to the center and use the value to stagger the animation
//4. Add random delay on top of the staggered delay value
struct ContentView: View {
// const & state
@dkun7944
dkun7944 / CDView.swift
Last active July 5, 2025 14:36
SwiftUI + Swift.Shader CD
//
// CDView.swift
// CD
//
// Created by Daniel Kuntz on 7/3/23.
//
import SwiftUI
struct ShapeWithHole: Shape {
@SpectralDragon
SpectralDragon / UIDynamicProviderImage.swift
Created October 31, 2019 11:33
A class for dynamically update image using current trait collections. It's doesn't work for navigation bar and tab bar, because image doesn't update when trait collection did change.
public extension UIImage {
/// Creates a dynamic image that supports displaying a different image asset when dark mode is active.
static func dynamic(
light makeLight: @autoclosure () -> UIImage,
dark makeDark: @autoclosure () -> UIImage
) -> UIImage {
if #available(iOS 13, *) {
return UIDynamicProviderImage(light: makeLight(), dark: makeDark())
} else {
@rpassis
rpassis / CoreDataChangeSetPlaygrounds.swift
Created January 13, 2019 18:07
Observe changes to a CoreData context using RxSwift
import UIKit
import CoreData
import Playgrounds
import RxSwift
import RxCocoa
@objc(ProductEntity)
final class ProductEntity: NSManagedObject {
@NSManaged public var uuid: String?
@NSManaged public var title: String?
@arturlector
arturlector / ios-questions-interview.md
Last active March 3, 2025 15:02
Вопросы на собеседование iOS разработчика.

Вопросы на собеседование iOS разработчика (дополненное издание):

General:

  • Что такое полиморфизм?

  • Что такое *инкапсуляция? Что такое *нарушение инкапсуляции?

  • Чем абстрактный класс отличается от интерфейса?

  • Расскажите о паттерне MVC. Чем отличается пассивная модель от активной?