Skip to content

Instantly share code, notes, and snippets.

@reeonce
reeonce / CMakeLists.txt
Created May 26, 2018 08:05
import prebuilt library with cmake
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(prebuilt-test)
function(IMPORT_PREBUILT_LIBRARY)
set(options)
set(oneValueArgs PROJECT_NAME ROOT_PATH PREBUILT_LIB)
set(multiValueArgs PREBUILT_LIBS DEPS)
cmake_parse_arguments(IPL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
@reeonce
reeonce / speech.js
Last active August 29, 2015 14:23
speechSynthesis js, it is working on Safari
function speech() {
var voices = window.speechSynthesis.getVoices();
var zhVoices = voices.filter(function (ele) { return ele.lang.match(/zh.*/i); });
var foo = new SpeechSynthesisUtterance('世界你好!');
foo.lang = 'zh-CN';
foo.voice = zhVoices[0];
foo.volume = 1; // 0 to 1
foo.rate = 1; // 0.1 to 10
foo.pitch = 1.5; //0 to 2
foo.voiceURI = 'native';
/**
* 引用不同的数据,会得到不同的地图切片
* 卫星(无地标) WGS-84 一般 GCJ-02
* <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
* 卫星(有地标) GCJ-02 一般 GCJ-02
* <script src="https://ditu.google.cn/maps/api/js?v=3.exp&sensor=false"></script>
*/
(function (map) {
var Converter = function () {
@reeonce
reeonce / gist:c13720290b8e15ea6175
Created March 4, 2015 07:19
share XCGLogger with Objective-C
//
// Logger.h
// banlv
//
// Created by Reeonce Zeng on 3/4/15.
// Copyright (c) 2015 Shen Zhen JIMI Data Technology Co.,Ltd. All rights reserved.
//
#ifndef banlv_ObjcLogger_h
#define banlv_ObjcLogger_h
@reeonce
reeonce / gist:68ec8474debf254e6df8
Created March 3, 2015 02:07
Get touch event on a CALayer with OC
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if ([touches count] == 1) {
for (UITouch *touch in touches) {
CGPoint point = [touch locationInView:[touch view]];
point = [[touch view] convertPoint:point toView:nil];
CALayer *layer = [(CALayer *)self.view.layer.presentationLayer hitTest:point];
layer = layer.modelLayer;
layer.opacity = 0.5;