Skip to content

Instantly share code, notes, and snippets.

@PhilCai1993
PhilCai1993 / TTVLImageDominantColor.h
Last active August 7, 2020 02:36
Get dominant colors of image
//
// TTVLImageDominantColor.h
// KMeans
//
// Created by PhilCai on 2020/8/6.
// Copyright © 2020 PhilCai. All rights reserved.
//
#import <UIKit/UIKit.h>
@PhilCai1993
PhilCai1993 / JSON2Code.js
Created February 13, 2020 05:51
JSON2Code.js
/** opyright 2017 www.wuhaichao.com
* Auto-generated:2017/8/19 下午4:27:29
* *
* * @author www.wuhaichao.com (whc)
* * @website http://wuhaichao.com
* * @github https://github.com/netyouli
* */
const WHCValueType = {
@PhilCai1993
PhilCai1993 / save_space.rb
Created December 12, 2019 12:56
Save disk space for victims of CocoaPods
gem 'cocoapods', '1.7.4'# only 1.7.4 tested.
require 'cocoapods'
module Pod
class Installer
def clean_pod_sources
UI.message "prevent default clean_pod_sources"
end
@PhilCai1993
PhilCai1993 / safari_jsbox.js
Created November 25, 2019 12:00
safari_jsbox.js
/* ©2019, Bionic Reading® */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.BionicReader = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (process){
"use strict";
var isNode = false;
try {
isNode
@PhilCai1993
PhilCai1993 / idevicesyslog.go
Last active September 9, 2019 05:55
idevicesyslog unicode support
package main
import (
"bufio"
"fmt"
"io"
"os/exec"
"strings"
)

UITesing Utilities

Contents

How to use

  • add the contents to your UITesting target
  • import XCTest-Private.h into your UITesting target bridging header
  • in your XCTestCase tearDown() method use the Springboard utility to delete the app and/or reset Location and Privacy Settings
@PhilCai1993
PhilCai1993 / build_config.rb
Created May 29, 2018 05:13 — forked from dorentus/build_config.rb
Put build_config.rb into mruby root dir, make, and put build_framework.rb into build dir and run it to get a MRuby.framework, run collect_mrb_gem_archive.rb <gem_name> in build dir to get a seperate <gem_name>.framework
MRuby::Build.new do |conf|
toolchain :clang
conf.gembox 'default'
end
def crossbuild_for(name, platform, sysroot, cc_defines = [])
MRuby::CrossBuild.new(name) do |conf|
toolchain :clang
conf.gembox 'default'
@PhilCai1993
PhilCai1993 / brightness.m
Last active October 18, 2017 09:46
detect brightness using ios camera
- (AVCaptureDevice *)frontCamera {
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
for (AVCaptureDevice *device in devices) {
if ([device position] == AVCaptureDevicePositionFront) {
return device;
}
}
return nil;
}
@PhilCai1993
PhilCai1993 / CoolieForObjectMapper.playground
Created February 25, 2016 09:48
CoolieForObjectMapper.playground
//
// Coolie.swift
// Coolie
//
// Created by NIX on 16/1/23.
// Copyright © 2016年 nixWork. All rights reserved.
//
import Foundation
@PhilCai1993
PhilCai1993 / FileEnum.swift
Created January 5, 2016 10:52
Swift查找项目图片
//
// FileEnum.swift
//
//
// Created by PhilCai on 1/5/16.
//
//
import Foundation
// MARK: Usage