Skip to content

Instantly share code, notes, and snippets.

View flashfoxter's full-sized avatar
🏠
Working from home

Konstantin Le flashfoxter

🏠
Working from home
View GitHub Profile
@flashfoxter
flashfoxter / EqualSpacingItemDecoration.java
Created May 25, 2018 17:20 — forked from alexfu/EqualSpacingItemDecoration.java
Add equal spacing to RecyclerView items automatically. Can handle horizontal, vertical, and grid display modes
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class EqualSpacingItemDecoration extends RecyclerView.ItemDecoration {
private final int spacing;
private int displayMode;
public static final int HORIZONTAL = 0;
@flashfoxter
flashfoxter / Mask.java
Created May 29, 2018 12:18 — forked from malvre/Mask.java
[Android] Mask format for EditText
public abstract class Mask {
public static String unmask(String s) {
return s.replaceAll("[.]", "")
.replaceAll("[-]", "")
.replaceAll("[/]", "")
.replaceAll("[(]", "")
.replaceAll("[)]", "");
}
@flashfoxter
flashfoxter / README.md
Created May 30, 2018 15:02 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@flashfoxter
flashfoxter / CustomView.java
Created June 9, 2018 10:59 — forked from samuel22gj/CustomView.java
Android custom view template
public class CustomView extends View {
public CustomView(Context context) {
this(context, null);
}
public CustomView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CustomView(Context context, AttributeSet attrs, int defStyle) {
@flashfoxter
flashfoxter / linkedin auto-inviter
Created July 12, 2018 11:16 — forked from maksii/linkedin auto-inviter
Script to automatically add connections from "People You May Know" page
var inviter = {} || inviter;
inviter.userList = [];
inviter.className = 'button-secondary-small';
inviter.refresh = function () {
window.scrollTo(0, document.body.scrollHeight);
window.scrollTo(document.body.scrollHeight, 0);
window.scrollTo(0, document.body.scrollHeight);
};
@flashfoxter
flashfoxter / BarcodeAdvancedDetector.kt
Created July 25, 2018 15:35 — forked from omarmiatello/BarcodeAdvancedDetector.kt
Barcode Detector for Mobile Vision API (Add support for inverted color)Benchmark on Pixel 2: Invert color (8ms) + Decode (15ms)
package com.satispay.customer.profile.visionapi
import android.graphics.ImageFormat
import android.util.SparseArray
import com.google.android.gms.vision.Detector
import com.google.android.gms.vision.Frame
import com.google.android.gms.vision.barcode.Barcode
import java.nio.ByteBuffer
@flashfoxter
flashfoxter / MergeIntervals.java
Created July 27, 2018 12:15 — forked from zac-xin/MergeIntervals.java
Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].
/**
* Definition for an interval.
* public class Interval {
* int start;
* int end;
* Interval() { start = 0; end = 0; }
* Interval(int s, int e) { start = s; end = e; }
* }
*/
@flashfoxter
flashfoxter / Android Studio Lint Inspections.md
Created August 1, 2018 15:35
Android Lint Suppress Warning Usage

Local Inspections

@SuppressWarnings("UndesirableClassUsage")
@SuppressWarnings("FileEqualsUsage")
@SuppressWarnings("GtkPreferredJComboBoxRenderer")
@SuppressWarnings("UnsafeVfsRecursion")
@SuppressWarnings("ConstantConditions")
@SuppressWarnings("UnusedAssignment")
@SuppressWarnings("NumericOverflow")
@SuppressWarnings("RedundantCast")
<?xml version="1.0" encoding="utf-8"?>
<!-- Add this as a debug manifest so the permissions won't be required by your production app -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
</manifest>
@flashfoxter
flashfoxter / rsyslog.mail.conf
Created February 26, 2019 09:53 — forked from coderofsalvation/rsyslog.mail.conf
rsyslog multiple ommail email sample configuration
$ModLoad ommail
$ActionMailSMTPServer 127.0.0.1
$template mailSubjectMemory,"Sopflop Memory issue"
$template mailSubjectError,"Sopflop Error"
$template mailSubjectException,"Sopflop Exception"
$template mailBody,"The following event triggered this email:\r\n\r\n%msg%"
### mail on memory issue
$ActionMailFrom [email protected]