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
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
@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
# 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
(function() { | |
var imageUrls = [], | |
totals = 0, | |
offset = 0, | |
qId = location.href.split('/').pop(); | |
$(".App-main").innerHTML = ''; | |
var style = " background: rgba(0,0,0,0.8); display: -webkit-flex; /* Safari */ -webkit-flex-wrap: wrap; /* Safari 6.1+ */ display: flex; flex-wrap: wrap; " | |
$("body").insertAdjacentHTML('beforeend', '<div id="img-fuli" style="' + style + '"><h1 style="color:#fff;">加载中,请稍后...</h1></div>'); | |
loadImg(); |
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 getAllUrlParams(url) { | |
// get query string from url (optional) or window | |
var queryString = url ? url.split('?')[1] : window.location.search.slice(1); | |
// we'll store the parameters here | |
var obj = {}; | |
// if query string exists | |
if (queryString) { |
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"); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>NSAllowsArbitraryLoads</key> | |
<true/> | |
</dict> | |
</plist> |
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 | |
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal | |
# make sure the output directory exists | |
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" | |
# Step 1. Build Device and Simulator versions | |
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build |
NewerOlder