Skip to content

Instantly share code, notes, and snippets.

@Cristo86
Cristo86 / crashes.log
Last active September 28, 2017 18:14
HiFi Crashes List
09-27 18:06:45.669 23857-23857/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-27 18:06:45.670 23857-23857/? A/DEBUG: Build fingerprint: 'HUAWEI/LON-L29/HWLON:7.0/HUAWEILON-L29/C900B159SP07:user/release-keys'
09-27 18:06:45.670 23857-23857/? A/DEBUG: Revision: '0'
09-27 18:06:45.670 23857-23857/? A/DEBUG: ABI: 'arm'
09-27 18:06:45.670 23857-23857/? A/DEBUG: pid: 23059, tid: 23120, name: QtThread >>> io.highfidelity.hifiinterface <<<
09-27 18:06:45.670 23857-23857/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x26
09-27 18:06:45.670 23857-23857/? A/DEBUG: r0 b07b2240 r1 bedff830 r2 917752c0 r3 0000000a
09-27 18:06:45.671 23857-23857/? A/DEBUG: r4 bedff830 r5 e362c400 r6 c52b1be0 r7 00000002
09-27 18:06:45.671 23857-23857/? A/DEBUG: r8 0000000c r9 00000000 sl 00000000 fp c52b1f78
09-27 18:06:45.671 23857-23857/? A/DEBUG: ip c8528ab4 sp c52b1bc0 lr c90e0a21 pc c90e0a3c cpsr 80070030
@Cristo86
Cristo86 / findLinePlaneIntersectionCoords.js
Created July 27, 2017 22:20
Returns the point where a plane intersects a given line
/**
* findLinePlaneIntersectionCoords (to avoid requiring unnecessary instantiation)
* Given points p with px py pz and q that define a line, and the plane
* of formula ax+by+cz+d = 0, returns the intersection point or null if none.
*/
function findLinePlaneIntersectionCoords(px, py, pz, qx, qy, qz, a, b, c, d) {
var tDenom = a*(qx-px) + b*(qy-py) + c*(qz-pz);
if (tDenom == 0) return null;
var t = - ( a*px + b*py + c*pz + d ) / tDenom;
@Cristo86
Cristo86 / android.toolchain.cmake.diff
Created June 28, 2017 13:39
Changes to make on the android toolchain file to make it work on Windows
+++ b/cmake/android/android.toolchain.cmake
@@ -362,6 +362,7 @@ if( NOT DEFINED ANDROID_NDK_HOST_X64 AND (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "a
endif()
set( TOOL_OS_SUFFIX "" )
+set( TOOL_OS_CLANG_SCRIPT_SUFFIX "" )
if( CMAKE_HOST_APPLE )
set( ANDROID_NDK_HOST_SYSTEM_NAME "darwin-x86_64" )
set( ANDROID_NDK_HOST_SYSTEM_NAME2 "darwin-x86" )
@@ -369,6 +370,7 @@ elseif( CMAKE_HOST_WIN32 )
public class CustomApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// ...
}
private static class DirsImpl implements Dirs {
@Cristo86
Cristo86 / BuildOkHttpClientWithCache1.java
Created July 6, 2016 20:18
Building an OkHttpClientWithCache v1
// By https://github.com/newfivefour/BlogPosts/blob/master/android-retrofit2-okhttp3-cache-network-request-offline.md
OkHttpClient client = new OkHttpClient
.Builder()
.cache(new Cache(App.sApp.getCacheDir(), 10 * 1024 * 1024)) // 10 MB
.addInterceptor(new Interceptor() {
@Override public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
if (App.isNetworkAvailable()) {
request = request.newBuilder().header("Cache-Control", "public, max-age=" + 60).build();
} else {
void method() {
// traditional way
Foo.methodThatTakesArrays(new int[]{1,2,3,4,5,6,7,8});
// or..
Foo.methodThatTakesArrays(ai(1,2,3,4,5,6,7,8));
}
/**
* Array of ints