Skip to content

Instantly share code, notes, and snippets.

View jebai0521's full-sized avatar
🎯
Focusing

Chen Ming jebai0521

🎯
Focusing
View GitHub Profile
- (void)captureOutput1:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
{
if (_finished) {
NSLog(@"Enter captureOutput:didOutputSampleBuffer, but return because finished");
return;
}
_zxcount ++;
// NSLog(@"Enter captureOutput:didOutputSampleBuffer %lu", (unsigned long)_zxcount);
@autoreleasepool {
#import <Foundation/Foundation.h>
@interface BarA : NSObject
//- (void) fun1;
//- (void) fun2;
@jebai0521
jebai0521 / index.html
Created August 28, 2015 10:36
js 判断 ios android 重定向
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
//判断访问终端
var browser={
@jebai0521
jebai0521 / gist:809dbe79a0f37c3d122c
Last active September 15, 2015 02:33
自动打开新的页面
<script type="text/javascript">
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
var timer = setInterval(function(){
clearInterval(timer);
var a=document.getElementById("ipa");
var dispatch = document.createEvent("HTMLEvents");
dispatch.initEvent("click", true, true);
a.dispatchEvent(dispatch);
},
@jebai0521
jebai0521 / gist:0732e30698893ad071b3
Created September 16, 2015 03:53
MultipartEntity 上传文件
public static String uploadFileV2(Context context, String RequestURL) throws JSONException
{
String BOUNDARY = UUID.randomUUID().toString(); // 边界标识 随机生成
String CONTENT_TYPE = "multipart/form-data"; // 内容类型
try
{
URL url = new URL(RequestURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(TIME_OUT);
@jebai0521
jebai0521 / gist:be112858ab6fc9b4e70b
Created January 13, 2016 10:46
java 使用 redis
package com.sencloud.redis.test;
import redis.clients.jedis.Jedis;
public class Test
{
public static void main(String[] args)
{
System.out.println("hellow");
@jebai0521
jebai0521 / mfc_app_singleton_C++
Created January 5, 2017 07:13 — forked from thinkhy/mfc_app_singleton_C++
mfc 应用程序的单例运行
BOOL InitInstance()
{
m_hMutex = ::CreateMutex(NULL, FALSE, APP_MUTEX_NAME);
if (NULL == m_hMutex)
{
Suicide();
return FALSE;
}
@jebai0521
jebai0521 / className.js
Last active September 25, 2019 13:55
Get the real class name in parent class with es6
class A {
constructor() {
console.log('constructor instance class', new.target.name);
}
}
class B extends A {
constructor() {
super();
'use strict';
const querystring = require('querystring');
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
// request.uri = "/zh-cn" + request.uri;
const s3DomainName = 'static-jebai.s3.amazonaws.com'
'use strict';
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
const s3DomainName = 'static-jebai.s3.amazonaws.com';
const countryCode = request.headers['cloudfront-viewer-country'][0].value.toLowerCase();
request.origin = {
s3: {
domainName: s3DomainName,
region: '',