Skip to content

Instantly share code, notes, and snippets.

View jebai0521's full-sized avatar
🎯
Focusing

Chen Ming jebai0521

🎯
Focusing
View GitHub Profile
@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 / 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 / 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: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 / 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={
#import <Foundation/Foundation.h>
@interface BarA : NSObject
//- (void) fun1;
//- (void) fun2;
- (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 {
btn.contentHorizontalAlignment = UIControlContentHorizonAlignmentLeft;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
#import <CommonCrypto/CommonDigest.h>
- (NSString *)md5HexDigest:(NSString*)password
{
const char *original_str = [password UTF8String];
unsigned char result[CC_MD5_DIGEST_LENGTH];
CC_MD5(original_str, strlen(original_str), result);
NSMutableString *hash = [NSMutableString string];
for (int i = 0; i < 16; i++)
{