Skip to content

Instantly share code, notes, and snippets.

View AlexanderGarmash's full-sized avatar
🎯
Focusing

Alexander Garmash AlexanderGarmash

🎯
Focusing
View GitHub Profile
make test
g++ -std=c++11 -I ../../distrib/include/ -I ../../distrib/tools/ -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi halide_blur_generator.cpp ../../distrib/lib/libHalide.a ../../distrib/tools/GenGen.cpp -o bin/halide_blur.generator -ldl -lpthread -lz -lz -lrt -ldl -lpthread -lm
../../distrib/lib/libHalide.a(Func.cpp.o):(.data+0x0): undefined reference to `llvm::EnableABIBreakingChecks'
../../distrib/lib/libHalide.a(Func.cpp.o): In function `_GLOBAL__sub_I__ZN6Halide4FuncC2ERKSs':
Func.cpp:(.text.startup+0x36c): undefined reference to `LLVMLinkInMCJIT'
../../distrib/lib/libHalide.a(Module.cpp.o): In function `Halide::Module::compile_to_buffer() const':
Module.cpp:(.text+0x1e66): undefined reference to `llvm::LLVMContext::LLVMContext()'
Module.cpp:(.text+0x1ed7): undefined reference to `vtable for llvm::raw_svector_ostream'
Module.cpp:(.text+0x1ee1): undefined reference to `llvm::raw_ostream::SetBufferAndMode(char*,
@AlexanderGarmash
AlexanderGarmash / YouTubeIFrameActivity.java
Last active November 29, 2016 14:55
Activity with webview, which can play youtube video and notify about finish. Doesn't require YouTube application / library. Also, has autoplay feature
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
Observable.from(imageStorageList)
.flatMap(uri -> new ImageUploadHelper().uploadImage(new File(uri.getPath())))
.map(uploadImageResponse -> {
if(uploadImageResponse.getStatusCode() != 200){
throw new RuntimeException("Unable to upload image"); // this will be thorwn to onError
} else {
return uploadImageResponse;
}
})
.toList()
ArrayList<ImageUploadResponse> responseArrayList = new ArrayList<>();
// call to upload the image
Observable.from(imageStorageList)
.flatMap(uri -> new ImageUploadHelper().uploadImage(new File(uri.getPath())))
.toList()
.map(list -> {
user.setProfileImageList(list);
return user;
})
.flatMap(user -> apiClient.UpdateUserProfile(/*here your authorization*/, user))
@AlexanderGarmash
AlexanderGarmash / retrofit-custom-error-handling.java
Last active August 29, 2015 14:26 — forked from benvium/retrofit-custom-error-handling.java
Fairly simply Retrofit custom error handling example. Is set up so that you don't need to do much work in the 'failure' handler of a retrofit call to get the user-visible error message to show. Works on all endpoints. There's lots of exception handling as our server folks like to keep us on our toes by sending all kinds of random stuff..!
// on error the server sends JSON
/*
{ "error": { "data": { "message":"A thing went wrong" } } }
*/
// create model classes..
public class ErrorResponse {
Error error;
@AlexanderGarmash
AlexanderGarmash / Activity1.java
Last active August 29, 2015 14:26 — forked from pommedeterresautee/Activity1.java
Here is a simple implementation of a wrapper to execute Observable in a dedicated Fragment. The main purpose is to manage screen rotation during the Async execution of an Observable. In my application several Activities implement the Observer Interface, without Fragment, so this implementation is built with that in mind. Of course, it can be upd…
package com.pommedeterresautee.rxtest;
import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
import rx.Observer;
final GridView gridView1 = (GridView)findViewById(R.id.gridView1);
ArrayList<String> listCountry1 = new ArrayList<String>();
listCountry1.add("China");
listCountry1.add("Japan");
listCountry1.add("Malaysia");
listCountry1.add("India");
listCountry1.add("Pakistan");
listCountry1.add("Indonesia");
listCountry1.add("Thailand");
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';