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
static const int target_key; | |
@implementation UIGestureRecognizer (Block) | |
+(instancetype)nvm_gestureRecognizerWithActionBlock:(NVMGestureBlock)block { | |
return [[self alloc]initWithActionBlock:block]; | |
} | |
- (instancetype)initWithActionBlock:(NVMGestureBlock)block { | |
self = [self init]; | |
[self addActionBlock:block]; |
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
void Swizzle(Class c, SEL orig, SEL new) { | |
Method origMethod = class_getInstanceMethod(c, orig); | |
Method newMethod = class_getInstanceMethod(c, new); | |
if (class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))){ | |
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); | |
} else { | |
method_exchangeImplementations(origMethod, newMethod); | |
} | |
} |
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 <objc/runtime.h> | |
void Swizzle(Class c, SEL orig, SEL new) { | |
Method origMethod = class_getInstanceMethod(c, orig); | |
Method newMethod = class_getInstanceMethod(c, new); | |
if (class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))){ | |
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); | |
} else { | |
method_exchangeImplementations(origMethod, newMethod); | |
} |
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
Verify Github on Galaxy. gid:YFmrbo9B4qaWDaTBSerJUN |
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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity >=0.7.0 <0.9.0; | |
/// @title 委托投票项目 | |
///为每个选项提供简称, 然后作为合约的创造者——即主席,将给予每个独立的地址以投票权。 | |
///地址后面的人可以选择自己投票,或者委托给他们信任的人来投票。 | |
///在投票时间结束时,winningProposal() 将返回获得最多投票的提案。 | |
contract Ballot { | |
struct Voter { |
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
// SPDX-License-Identifier: MIT | |
pragma solidity >=0.7.0 <0.9.0; | |
contract EtherWallet { | |
address payable public owner; | |
constructor() { | |
owner = payable(msg.sender); | |
} |
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
// | |
// ContentView.swift | |
// coremlsd2test | |
// | |
// Created by Yasuhito Nagatomo on 2022/12/03. | |
// | |
// A sample code using Apple/ml-stable-diffusion library. | |
// Preparation: | |
// 1. convert the PyTorch Stable-Diffusion v2 model to coreml models using Apple's tools. | |
// 2. import the coreml models into the iOS project. |