Skip to content

Instantly share code, notes, and snippets.

import { Component } from '@angular/core';
@Component({
selector: '',
template: '',
styles: []
})
export class Test {}
@satanworker
satanworker / event_mutation.html
Created March 21, 2017 15:41
event.prototype mutation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
</head>
<body>
<div class="for_test">
@satanworker
satanworker / placeholder.scss
Created March 24, 2017 01:59
placeholder mixin
@mixin optional-at-root($sel) {
@at-root #{if(not &, $sel, selector-append(&, $sel))} {
@content;
}
}
@mixin placeholder {
@include optional-at-root('::-webkit-input-placeholder') {
@content;
}
@satanworker
satanworker / carousel.swift
Last active September 24, 2022 14:31
SwiftUI full width carousel
@satanworker
satanworker / ERC20.t.sol
Created May 13, 2022 08:04
Foundry dealing custom ERC20
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import "../../lib/ds-test/src/test.sol";
import "../../lib/forge-std/src/Vm.sol";
import "../../lib/forge-std/src/Test.sol";
interface ERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address tokenOwner) external view returns (uint balance);
@satanworker
satanworker / FlatMap.swift
Created May 29, 2023 19:27
`flatMap` на вход приходит (String) и на выход `Effect(result)`
func testAsyncEffect() -> Effect<Int, MainError> {
Effect<String, MainError>.future { callback in
DispatchQueue.global().async {
sleep(5)
callback(.success("All good"))
}
}
.flatMap { value -> Effect<Int, MainError> in
Effect.result {
.success(2)
@satanworker
satanworker / .eraseToEffect vs .catchToEffect.swift
Created May 29, 2023 19:28
`.eraseToEffect` - когда нужно схлопнуть несколько операторов в один эффект, чтобы компилятор не отъехал
func testAsyncEffect() -> Effect<Int, MainError> {
Effect<String, MainError>.future { callback in
DispatchQueue.global().async {
sleep(5)
callback(.success("All good"))
}
}
.flatMap { value -> Effect<Int, MainError> in
Effect.result {
.success(2)
# Transfer
# Transfer swap
async transferSwap(userId: number, accountIndex: number, params: { swapTxParams: SwapTxParams }) {
const { swapTxParams } = params;
const [connectedWallet, secretKey] = await Promise.all([
await this.walletService.getTONWallet({
userId,
accountIndex
}),
// import { Address } from "@ton/core";
import { JettonsService } from "../../jettons/jettonsService";
import { WalletService } from "../../wallet/walletService";
import { PROXY_TON, Web3TransportService } from "../../web3infra/web3TransportService";
import { zeroTONtopTON } from "../../web3infra/zeroTONtopTON";
import { Asset, Factory, MAINNET_FACTORY_ADDR, PoolType, VaultNative, ReadinessStatus, JettonRoot, VaultJetton, Pool } from '@dedust/sdk';
import { Address, OpenedContract, Sender, toNano, TonClient, TonClient4, WalletContractV3R1, WalletContractV4 } from "@ton/ton";
import { SimulateSwap, Swap } from "../swapService";
export class Dedust {
{
"redirects": [
{
"source": "/(.*)/",
"destination": "/$1",
"permanent": true
},
{
"source": "/index.html",
"destination": "/",