Skip to content

Instantly share code, notes, and snippets.

View calvingit's full-sized avatar
😈

Calvin calvingit

😈
View GitHub Profile
@calvingit
calvingit / static lib build script
Last active August 26, 2015 03:18 — forked from Coneboy-k/static lib build script
static lib build script support armv7 armv7s arm64 i386 x86_64
#!/bin/bash
#
# This script was inspired by Coneboy_K
#
# 介绍:
# 这个脚本全部自动化编译各指令集静态库后合并。现在支持指令集有armv7 armv7s arm64 i386 x86_64
#
# 使用:
# 首先cd 到xcode工程目录 然后运行 "sh ./build.sh" PS:xcode不能含有xcodebuild的Runscript切记!
#
@interface UILabel (dynamicSizeMe)
-(float)resizeToFit;
-(float)expectedHeight;
@end
@calvingit
calvingit / translation.py
Created October 19, 2016 08:10
iOS 调用百度翻译 API 将中文 strings 翻译成其他国家语言
# /usr/bin/env python
# -*- coding: utf-8 -*-
# 同级目录下面包含 Localizable.strings 或者 InfoPlist.strings,把strings文件的注释都去掉
# cnFile 参数修改需要翻译Localizable还是InfoPlist
# 到百度翻译API页面申请免费的appid和secretKey(http://api.fanyi.baidu.com/api/trans/product/index)
# 百度翻译每月翻译字符数低于200万,享免费服务
# 会自动生成对应的.lproj目录
import httplib
@calvingit
calvingit / Remove-Framework-Unwanted-Archs.sh
Created November 22, 2016 07:35
第三方的framework一般都兼容模拟器和真机arch,但是上架时不能包含模拟器的arch,这个脚本的作用就是打包时移除无效的archs
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
if [ "${CONFIGURATION}" == "Release" ]; then
# 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"
@calvingit
calvingit / RxPermission.swift
Created December 15, 2017 03:24
RxSwift bindings for Permission API that helps you with Permissions in iOS.
//
// RxPermission.swift
//
// Copyright (c) 2016 Sunshinejr <thesunshinejr@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@calvingit
calvingit / google-translate.py
Created October 25, 2016 04:01
调用Google Translate API 翻译
# /usr/bin/env python
# -*- coding: utf-8 -*-
# 同级目录下面包含 Localizable.strings 或者 InfoPlist.strings,把strings文件的注释都去掉
# cnFile 参数修改需要翻译Localizable还是InfoPlist
# 到Google翻译API页面申请Key(https://cloud.google.com/translate/v2/quickstart),送300美刀,免费2个月
# 安装google-api-python-client (https://developers.google.com/api-client-library/python/apis/translate/v2)
# pip install --upgrade google-api-python-client
# 会自动生成对应的.lproj目录
# 注意: 葡萄牙语、繁体中文的语言缩写分别是pt和zh-TW,这个和Xcode的目录有点区别,其他语言都一样
@calvingit
calvingit / .vimrc
Created August 7, 2021 03:05 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@calvingit
calvingit / DependencyContainer.swift
Created November 4, 2023 11:34
依赖管理工具
//
// DependencyContainer.swift
// DependencyContainer
//
// Created by zhangwen on 2023/11/1.
//
import Foundation
@objc
class DependencyContainer: NSObject {
@calvingit
calvingit / EventPublisher.swift
Created November 4, 2023 11:34
广播事件分发器
import Foundation
// 事件
@objcMembers
class EPEvent: NSObject {
/// 事件 id,唯一
private(set) var id: String = ""
/// 对象参数
private(set) var object: Any?
//
// UIViewController+Popover.swift
// HomeMate
//
// Created by zhangwen on 2023/6/29.
// Copyright © 2023 Legrand Intelligent Electrical (Huizhou) Co., Ltd. All rights reserved.
//
import UIKit