Skip to content

Instantly share code, notes, and snippets.

View Aksi0m's full-sized avatar
💭
🐿

Renato Turic Aksi0m

💭
🐿
View GitHub Profile
2020-12-01 10:03:11.271 27575-28063/co.infinum.hpb.staging I/BugFraudSDK: ********** 2020-12-01 10:03:11.27
2020-12-01 10:03:11.272 27575-28063/co.infinum.hpb.staging I/BugFraudSDK: start set OK in this Activity.
2020-12-01 10:03:11.272 27575-28063/co.infinum.hpb.staging I/BugFraudSDK: registerUsernameField was not called in this Activity.
2020-12-01 10:03:11.272 27575-28063/co.infinum.hpb.staging I/BugFraudSDK: registerPasswordField was not called in this Activity.
2020-12-01 10:03:11.272 27575-28063/co.infinum.hpb.staging I/BugFraudSDK: recordTouchEvent was not called in this Activity.
2020-12-01 10:03:11.272 27575-28063/co.infinum.hpb.staging I/BugFraudSDK: setPosition set OK with value: mrib_e_cash_send_code in this Activity.
2020-12-01 10:03:11.272 27575-28063/co.infinum.hpb.staging I/BugFraudSDK: setCustomerId set OK with value: Hpb-pruebas in this Activity.
2020-12-01 10:03:11.272 27575-28063/co.infinum.hpb.staging I/BugFraudSDK: setSessionId set OK with value: 6ad320ed-b59f-4bdb-ab62-d6b3f7d7b60b in
@Aksi0m
Aksi0m / git_aliases.txt
Created November 11, 2019 23:14
git aliases
# daily git list in repo
alias today='git log --since=6am --format="* %s" --author="$(git config user.email)" --reverse -- | pbcopy'
alias yesterday='git log --since=yesterday.6am --until=6am --format="* %s" --author="$(git config user.email)" --reverse -- | pbcopy'
# git log pretty by renato
alias gilog="git log --date=short --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%ad%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
@Aksi0m
Aksi0m / MainActivity.java
Created September 24, 2019 14:14
This is the mainactivity/first activity of the application that's there long enough to make the async install ing of the SecurityProvider work.
public class MainActivity extends Activity implements ProviderInstaller.ProviderInstallListener {
private static final int ERROR_DIALOG_REQUEST_CODE = 1;
private boolean mRetryProviderInstall;
//Update the security provider when the activity is created.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ProviderInstaller.installIfNeededAsync(this, this);
}
/**
@Aksi0m
Aksi0m / SyncAdapter.java
Created September 24, 2019 14:11
This is a sync adapter that runs in the background, so you can run the synchronous patching.
public class SyncAdapter extends AbstractThreadedSyncAdapter {
...
// This is called each time a sync is attempted; this is okay, since the
// overhead is negligible if the security provider is up-to-date.
@Override
public void onPerformSync(Account account, Bundle extras, String authority,
ContentProviderClient provider, SyncResult syncResult) {
try {
ProviderInstaller.installIfNeeded(getContext());
} catch (GooglePlayServicesRepairableException e) {
{
"name":"A product",
"weight":400,
"description":"A great product",
"_links":{
"self":{
"href":"/product/987"
}
},
"_embedded":{
@Aksi0m
Aksi0m / OkHttp2Glide3ModelLoader.kt
Created May 11, 2018 10:45
Glide + OkHttp2.x integration - for all those who still use OkHttp 2.x :(
class HpbModuleLoader(private val client: OkHttpClient) : ModelLoader<GlideUrl, InputStream> {
override fun getResourceFetcher(model: GlideUrl, width: Int, height: Int): DataFetcher<InputStream> {
return OkHttpStreamFetcher(client, model)
}
class Factory constructor(private val client: OkHttpClient) : ModelLoaderFactory<GlideUrl, InputStream> {
override fun build(context: Context, factories: GenericLoaderFactory): ModelLoader<GlideUrl, InputStream> {
return HpbModuleLoader(client)
var stage = new Konva.Stage({
container: 'canvasContainer',
width: 500,
height: 450
});
var layer = new Konva.Layer();
stage.add(layer);
public void copyAppDbToDownloadFolder() throws IOException {
File backupDB = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "databaseBackupName.db");
File currentDB = getApplicationContext().getDatabasePath("databaseName.db");
if (currentDB.exists()) {
FileChannel src = new FileInputStream(currentDB).getChannel();
FileChannel dst = new FileOutputStream(backupDB).getChannel();
dst.transferFrom(src, 0, src.size());
src.close();
dst.close();
}