Skip to content

Instantly share code, notes, and snippets.

View carloseduardosx's full-sized avatar
🎯
Focusing

Carlos Eduardo carloseduardosx

🎯
Focusing
View GitHub Profile
@carloseduardosx
carloseduardosx / AutoIncrementEntity.java
Last active January 18, 2021 05:36
RealmAutoIncrement is a singleton which maintain the last id saved from each database model
package com.carloseduardo.model;
import com.carloseduardo.constants.KnownClasses;
import com.carloseduardo.exception.UnknownModelException;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
import io.realm.annotations.Required;
/**
@carloseduardosx
carloseduardosx / RealmAutoIncrement.java
Last active January 18, 2021 05:35
RealmAutoIncrement is a singleton which maintain the last id saved from each database model
package com.carlosedurdo.database;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import io.realm.Realm;
import io.realm.RealmObject;
/**
@carloseduardosx
carloseduardosx / configure_git_hook.md
Last active April 18, 2019 19:11
Step by step to configure git hook

1. Create a folder called "git_template"

2. Create a folder inside git_template called "hooks"

3. Create the hook file "prepare-commit-msg" inside the hooks folders and then place the following code inside it:

#!/bin/bash
orig_msg_file="$1"
temp="temp_message"
branch=$( git branch | grep '^\*' | cut -b3- )
task=$( sed -E "s/feature\/|hotfix\/|react\///g" <<< "$branch" )
@carloseduardosx
carloseduardosx / CapsLockCtrlEscape.ahk
Created March 14, 2019 15:49 — forked from sedm0784/CapsLockCtrlEscape.ahk
AutoHotkey script to map Caps Lock to Escape when it's pressed on its own and Ctrl when used in combination with another key, à la Steve Losh. Adapted from one that does something similar with the Ctrl Key on the Vim Tips Wiki (http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows?oldid=32281). (Plus contribs from @randy909 & @mmikeww.)
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*CapsLock::
if (g_ControlRepeatDetected)
{
return
}
@carloseduardosx
carloseduardosx / BINs.md
Last active May 24, 2018 20:05
Regex for test BINs(Bank Identification Number)

This is a list of Regex to match BINs of some credit/debit card brands

American Express

Possible prefixes

  • 34
  • 37
/^3[47]/g
@carloseduardosx
carloseduardosx / RxJavaSchedulersChangedRule.kt
Last active December 31, 2016 03:52
Simple JUnit TestRule for do something when Observable schedulers change
package com.carloseduardo.rules
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
import rx.Scheduler
import rx.android.plugins.RxAndroidPlugins
import rx.android.plugins.RxAndroidSchedulersHook
import rx.plugins.RxJavaHooks
import rx.schedulers.Schedulers
@carloseduardosx
carloseduardosx / CriteriaBuilder.java
Last active March 29, 2016 17:10
Builder to hibernate criteria
package com.carlosedurdo.core.builder;
import com.carlosedurdo.core.model.Criteria;
import com.carlosedurdo.core.util.ArrayUtil;
import org.hibernate.criterion.MatchMode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;