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
# Uncomment the next line to define a global platform for your project | |
platform :ios, '9.0' | |
target 'demo' do | |
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks | |
use_frameworks! | |
end | |
post_install do |installer| | |
installer.pods_project.targets.each do |target| |
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
@interface NSObject (hook) | |
+ (void)switchClassFuction:(NSString *)originalSelectorName swizzledSelector:(NSString *)swizzledSelectorName; | |
+ (void)switchInstanceFuction:(NSString *)originalSelectorName sel2:(NSString *)swizzledSelectorName; | |
@end | |
@implementation NSObject (hook) | |
+ (void)switchClassFuction:(NSString *)originalSelectorName swizzledSelector:(NSString *)swizzledSelectorName { | |
Class class = object_getClass((id)self); | |
SEL originalSelector = NSSelectorFromString(originalSelectorName); |
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
#!/bin/sh | |
# | |
echo '' | |
echo '/*教程请参考:极路由Shadowsocks家庭无痛翻墙实践*/' | |
echo 'https://luolei.org/hiwifi-shadowsocks/' | |
echo 'by @foru17' | |
echo '' | |
echo '' | |
echo '那一天,' | |
echo '人类终于回想起了,' |
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
(function(exports) { | |
// 打印按钮的action及其target | |
zxactionWithTargets = function actionWithTargets(button) { | |
var allTargets = [button allTargets].allObjects(); | |
if (!allTargets) { | |
return "is not a uicontrol" | |
} | |
var allShow = []; | |
for (var i = 0; i < allTargets.length; i++) { | |
var target = allTargets[i]; |
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
tell application "Finder" | |
set pathList to (quoted form of POSIX path of (folder of the front window as alias)) | |
set command to "clear; cd " & pathList | |
end tell | |
tell application "System Events" | |
-- some versions might identify as "iTerm2" instead of "iTerm" | |
set isRunning to (exists (processes where name is "iTerm")) or (exists (processes where name is "iTerm2")) | |
end tell | |
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
@echo off | |
title Concat images vertically | |
echo Begin | |
set datetimef=%date:~0,2%-%date:~3,2%_%time:~0,2%-%time:~3,2%-%time:~6,2% | |
echo %datetimef% | |
setlocal enabledelayedexpansion | |
set argCount=0 |
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
extension UIImage { | |
// first frame of gif | |
class func firstFrame(gif url: URL) -> UIImage? { | |
guard let data = try? Data(contentsOf: url) as CFData else { | |
return nil | |
} | |
guard let source = CGImageSourceCreateWithData(data, nil) else { | |
return nil | |
} | |
guard let cgimage = CGImageSourceCreateImageAtIndex(source, 0, nil) else { |
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 session = AVAudioSession.sharedInstance() | |
try? session.setActive(true) | |
if !isSpeakerMode { | |
// NSLog(@"Device is close to user"); | |
do { | |
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord) | |
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none) | |
} catch _ {} | |
} else { | |
// NSLog(@"Device is not close to user"); |
OlderNewer