Skip to content

Instantly share code, notes, and snippets.

View tucomel's full-sized avatar
🇧🇷

Arthur Oliveira de Melo tucomel

🇧🇷
View GitHub Profile
@tucomel
tucomel / MoneyTextWatcher.java
Last active October 9, 2018 20:07
MoneyTextWatcher Android
public class MoneyTextWatcher extends METValidator implements TextWatcher, View.OnFocusChangeListener {
public static final String T = "MoneyTextWatcher";
protected int max_length = Integer.MAX_VALUE;
private EditText editText;
private View linkedText;
private String formatType;
private String current = "";
private boolean insertingSelected = false;
private boolean isDeleting;
private MoneyTextDelegate delegate;
/**
* @param str String with special caracters
* @return double value of string
*/
public static double toDouble(String str) {
str = str.replaceAll("[^\\d]", "");
if (str != null && str.length() > 0) {
return Double.parseDouble(str) / 100;
} else {
return 0;
@tucomel
tucomel / macOS links.md
Last active February 25, 2019 03:22
macOS links that apple removed from apple store
public class NumberView extends View {
private final Interpolator mInterpolator;
private final Paint mPaint;
private final Path mPath;
// Numbers currently shown.
private int mCurrent = 0;
private int mNext = 1;
@tucomel
tucomel / themeToggler.applescript
Last active September 10, 2022 04:41
MacOS applescript smoothly dark mode toggle
(* based on https://gist.github.com/davedelong/850409c512ab2d2a21aa6fa690096d56 *)
on setDarkModeSmothly(shouldBeDark)
tell application "System Events"
if dark mode of appearance preferences is shouldBeDark then
return "no changes"
end if
end tell
if shouldBeDark then
set mode to "dark"