This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jobject StlStringStringMapToJavaHashMap(JNIEnv *env, const std::map<std::string, std::string>& map) { | |
jclass mapClass = env->FindClass("java/util/HashMap"); | |
if(mapClass == NULL) | |
return NULL; | |
jmethodID init = env->GetMethodID(mapClass, "<init>", "()V"); | |
jobject hashMap = env->NewObject(mapClass, init); | |
jmethodID put = env->GetMethodID(mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); | |
std::map<std::string, std::string>::const_iterator citr = map.begin(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
# common shortcuts | |
git config --global alias.co checkout | |
git config --global alias.ci commit | |
git config --global alias.st status | |
git config --global alias.br branch | |
git config --global alias.rb rebase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ATOMIC_H | |
#define ATOMIC_H | |
// Adapted from http://golubenco.org/2007/06/14/atomic-operations | |
/** | |
* @brief Atomic type | |
*/ | |
typedef int atomic_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The MIT License | |
* | |
* Copyright (c) 2011 Paul Solt, PaulSolt@gmail.com | |
* | |
* https://github.com/PaulSolt/UIImage-Conversion/blob/master/MITLicense.txt | |
* | |
*/ | |
#import <Foundation/Foundation.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSWeakTimer.m | |
#import "NSWeakTimer.h" | |
@interface NSWeakTimerTarget : NSObject | |
@property (weak) id target; | |
@property (assign) SEL selector; | |
@property (assign) NSTimer* timer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)getPixelBuffer:(CVPixelBufferRef *)pbuf { | |
@synchronized (self) { | |
if(!_pFrame || !_pFrame->data[0]) | |
return; | |
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: | |
// [NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey, | |
// [NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey, | |
@(_pFrame->linesize[0]), kCVPixelBufferBytesPerRowAlignmentKey, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.emil.android.util; | |
import android.content.Context; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
import android.telephony.TelephonyManager; | |
/** | |
* Check device's network connectivity and speed | |
* @author emil http://stackoverflow.com/users/220710/emil |