Skip to content

Instantly share code, notes, and snippets.

View alimogh's full-sized avatar

alimogh

View GitHub Profile
/**
* This is a direct port of https://github.com/nathan-fiscaletti/ansi-util
*
* @author Nathan Fiscaletti
* @see https://github.com/nathan-fiscaletti/ansi-util
*
* Usage:
*
* StringBuilder sb = new StringBuilder();
*
@alimogh
alimogh / Spinner Setup (Activity)
Created March 21, 2021 19:48 — forked from Suleiman19/Spinner Setup (Activity)
Theme Aware Material Design Spinner
Spinner spinner = (Spinner) findViewById(R.id.main_spinner);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getSupportActionBar().getThemedContext(),
R.layout.spinner_list_style,
getResources().getStringArray(R.array.countries));
spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
spinner.setAdapter(spinnerAdapter);
@whittlem
whittlem / relativeStrengthIndex.py
Last active May 2, 2024 21:49
Trading using Python — Relative Strength Index (RSI)
# data: dictionary { 'dd/mm/yyy': price, 'dd/mm/yyyy': price, ... }
def relativeStrengthIndex(data, num):
if not isinstance(data, dict):
raise Exception('Dictionary input expected')
if not isinstance(num, int):
raise Exception('Integer input expected')
@alimogh
alimogh / webView Back Button Press Example
Created July 29, 2020 16:28 — forked from mattieapps/webView Back Button Press Example
A working way of making Android WebView go back one page on "back key" press
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
@jmoz
jmoz / rsi.py
Created September 27, 2019 07:41
RSI calculation to match Tradingview
import pandas as pd
def rsi(ohlc: pd.DataFrame, period: int = 14) -> pd.Series:
"""See source https://github.com/peerchemist/finta
and fix https://www.tradingview.com/wiki/Talk:Relative_Strength_Index_(RSI)
Relative Strength Index (RSI) is a momentum oscillator that measures the speed and change of price movements.
RSI oscillates between zero and 100. Traditionally, and according to Wilder, RSI is considered overbought when above 70 and oversold when below 30.
Signals can also be generated by looking for divergences, failure swings and centerline crossovers.
@onatakduman
onatakduman / recyclerview_adapter.java
Created July 23, 2019 19:47
RecyclerView Adapter Template (Java)
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.RecyclerView;
@rene-d
rene-d / colors.py
Last active July 9, 2025 18:34
ANSI color codes in Python
# SGR color constants
# rene-d 2018
class Colors:
""" ANSI color codes """
BLACK = "\033[0;30m"
RED = "\033[0;31m"
GREEN = "\033[0;32m"
BROWN = "\033[0;33m"
BLUE = "\033[0;34m"
android.buildTypes {
release {
// You must use the following property to specify additional ProGuard
// rules for dynamic feature modules.
consumerProguardFiles 'proguard-rules-dynamic-features.pro'
}
}
@TasnuvaOshin
TasnuvaOshin / Activity_main.xml
Created February 2, 2018 10:09
Android JSON data parsing showing into ListView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.oshin.myjsonlist.MainActivity">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
@andre77
andre77 / Main.java
Last active May 10, 2021 05:59
Example last trade
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import bittrex.BittrexWS;
import bittrex.CurrencyPair;
import bittrex.Trade;