Skip to content

Instantly share code, notes, and snippets.

@jackyshan
jackyshan / findcontent.py
Created December 6, 2016 06:18
Python查找当前目录下文件的匹配内容
import os
for file in os.listdir(os.getcwd()):
f = open(file)
content = f.readline()
while content:
if 'xxx' in content :
print content
pass
content = f.readline()
@jackyshan
jackyshan / xls_db.py
Created December 7, 2016 03:56
处理excel导出db数据
import xlrd
data = xlrd.open_workbook('xx.xls')
fo = open("xx.txt", "w")
for i in range(len(data.sheets())):
table = data.sheets()[i]
nrows = table.nrows
for row in range(nrows):
@jackyshan
jackyshan / website_easybuy.js
Created December 17, 2016 03:27
官网购一键购链接弹出
defineClass("YTPlatWebsiteDetailViewController", {
//instance method definitions
webViewDidStartLoad: function(webView) {
self.progressView().setProgress_animated(0.9, true)
self.buyBtn().setSelected(true)
},
webViewDidFinishLoad: function(webView) {
self.progressView().setProgress_animated(1.0, true)
self.buyBtn().setSelected(true)
}
@jackyshan
jackyshan / getCoupons.js
Created December 19, 2016 06:56
分享领券刷手机号
mobs = new Array()
for (var index = 10; index < 100; index++) {
var mobile = '186201121'+index
mobs.push(mobile)
}
var index = 0
window.setInterval(function(){
mobile = mobs[index++]
$.ajax('/share/get_free_service',{
@jackyshan
jackyshan / jkviewDidDisappear_net.m
Last active March 23, 2017 01:30
使用runtime轻松实现iOS页面消失,当前网络断开请求
- (void)jkviewDidDisappear:(BOOL)animated {
[self jkviewDidDisappear:animated];
if ([[self class] isSubclassOfClass:[YTNavigationController class]]) {
return;
}
else if ([NSStringFromClass([self class]) hasPrefix:@"UI"]) {
return;
}
else if ([[self class] isSubclassOfClass:[UIViewController class]]) {
@jackyshan
jackyshan / modifyi386x86_64scriptshell.shell
Created April 10, 2017 03:14
脚本修改i386 x86_64上传App Store报错
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
@jackyshan
jackyshan / liporemovearchive.sh
Created April 10, 2017 03:11
删除framework架构i386,x86_64
lipo -remove i386 RxSwift.framework/RxSwift -output RxSwift.framework/RxSwift
lipo -remove x86_64 RxSwift.framework/RxSwift -output RxSwift.framework/RxSwift
@jackyshan
jackyshan / RxSwiftUIBindPartical.swift
Created April 14, 2017 03:00
RxSwift基础UI绑定实战总结
//
// BusDriverFeedbackViewController.swift
// renttravel
//
// Created by jackyshan on 2017/3/8.
// Copyright © 2017年 GCI. All rights reserved.
//
import UIKit
import RxSwift
@jackyshan
jackyshan / activity_life.java
Last active May 6, 2017 11:04
activity生命周期
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_table);
}
@Override
protected void onStart() {//开启
super.onStart();
}
@jackyshan
jackyshan / navigationcontrollertransition.m
Created May 8, 2017 08:24
navigationcontroller页面翻转
override func backBtnAction() {
UIView.transition(with: (self.navigationController?.view)!, duration: 0.7, options: .transitionFlipFromLeft, animations: {
self.navigationController?.popViewController(animated: false)
}, completion: nil)
}
let vc = BusLineMapViewController()
UIView.transition(with: (self.navigationController?.view)!, duration: 0.7, options: .transitionFlipFromRight, animations: {
self.navigationController?.pushViewController(vc, animated: false)
}, completion: nil)