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
// ==UserScript== | |
// @name XiSai | |
// @namespace https://gist.github.com/victorchee/e5cec41982f3fbf611faa0e6f88459c6.js | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author VictorChee | |
// @match https://wangxiao.xisaiwang.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=45.185 | |
// @grant none | |
// ==/UserScript== |
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
'use strict'; | |
const fs = require('fs'); | |
const read = fs.readdirSync('./'); | |
let string = ''; | |
for (let i in read) { | |
const item = read[i]; | |
const index = item.lastIndexOf('.'); | |
string += item.substring(0, index) + '\n'; |
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
const fs = require('fs'); | |
const path = require('path'); | |
const fetch = require('node-fetch'); | |
if (!fs.existsSync('images')) { | |
fs.mkdirSync('images'); | |
} | |
async function download(url) { | |
const request = await fetch(url); |
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 UIKit | |
extension URLSession { | |
func dataTask(with url: URL, completionHandler: @escaping (Result<Data, Error>, URLResponse?) -> Void) -> URLSessionDataTask { | |
return dataTask(with: url) { (data, response, error) in | |
if let error = error { | |
completionHandler(.failure(error), response) | |
} else { | |
completionHandler(.success(data ?? Data()), response) | |
} |
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
// Objective-C | |
#if TARGET_IPHONE_SIMULATOR | |
// Simulator | |
#else | |
// Device | |
#endif | |
// Swift | |
#if targetEnvironment(simulator) | |
// your simulator code |
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 "请输入需要检测的工程路径" | |
read path | |
if [ ${#path} = 0 ] | |
then | |
echo "请在.sh文件后面添加路径" | |
exit | |
fi | |
cd $path | |
echo "当前路径为`pwd`" |
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 UIKit | |
enum PanDirection { | |
case vertical | |
case horizontal | |
} | |
class PanDirectionGestureRecognizer: UIPanGestureRecognizer { | |
let direction: PanDirection | |
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 emitterLayer = CAEmitterLayer() | |
emitterLayer.frame = navigationView.bounds | |
emitterLayer.renderMode = .additive | |
emitterLayer.emitterMode = .outline | |
emitterLayer.emitterShape = .line | |
emitterLayer.emitterSize = CGSize(width: 50, height: 0) | |
emitterLayer.emitterPosition = CGPoint(x: navigationView.bounds.width / 2, y: navigationView.bounds.height) | |
emitterLayer.velocity = 1 | |
emitterLayer.seed = (arc4random() % 100) + 1 | |
navigationView.layer.insertSublayer(emitterLayer, at: 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
let emitterLayer = CAEmitterLayer() | |
emitterLayer.frame = navigationView.bounds | |
emitterLayer.renderMode = .oldestLast | |
emitterLayer.emitterShape = .rectangle | |
emitterLayer.emitterSize = CGSize(width: navigationView.bounds.width, height: navigationView.bounds.height / 2) | |
emitterLayer.emitterPosition = CGPoint(x: navigationView.bounds.width / 2, y: 0) | |
navigationView.layer.insertSublayer(emitterLayer, at: 0) | |
let emitterCell = CAEmitterCell() | |
emitterCell.contents = UIImage(named: "triangle1")?.cgImage |
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
UIView.animate(withDuration: 0.25, animations: { | |
self.collectionView?.setContentOffset(CGPoint.zero, animated: false) | |
}) { (finished) in | |
self.collectionView.refreshControl?.beginRefreshing() | |
self.collectionView.refreshControl?.sendActions(for: .valueChanged) | |
self.collectionView.setContentOffset(CGPoint(x: 0, y: -60), animated: false) | |
} |
NewerOlder