Skip to content

Instantly share code, notes, and snippets.

public final class DialogFactory {
public static Dialog createSimpleOkErrorDialog(Context context, String title, String message) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
.setTitle(title)
.setMessage(message)
.setNeutralButton(R.string.dialog_action_ok, null);
return alertDialog.create();
}
public final class Mixer {
static void convertToStereo(short[] monoSamples, short[] stereoSamples) {
for (int i = 0, st = 0, len = monoSamples.length; i < len; ++i) {
stereoSamples[st++] = monoSamples[i];
stereoSamples[st++] = monoSamples[i];
}
}
static void convertToMono(short[] stereoSamples) {
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@iUmarov
iUmarov / UniqueIntRandom.java
Created November 11, 2017 02:24
Unique Random Int Numbers in Java
public class UniqueIntRandom {
private ArrayList<Integer> numberStore;
public UniqueIntRandom(int startingNum, int endNum) {
numberStore = new ArrayList<>();
initRandomNumbers(startingNum, endNum);
}
public UniqueIntRandom(int endNum) {
@iUmarov
iUmarov / Animation.R
Created November 14, 2017 08:58
Cartoon animation R
#install.packages("animation")
# install.packages("jpeg") ## if necessary
library(animation)
library(jpeg)
ani.options(interval = 0.5)
for(i in 1:8){
img <- paste("~/Documents/R/photo_", i, ".jpg", sep="")
@iUmarov
iUmarov / Tashkent.r
Created November 21, 2017 10:14
7 Markers in Tashkent
#install.packages("ggplot2")
library(ggplot2)
names <- c("Toshkent Xalqa Avtomobil Yo'li, Tashkent, Uzbekistan",
"Istiklol Palace",
"Dinamo",
"Tashkent Higher All-Troops Command College",
"SARC Uzbekiston Temir Yullari",
"Amir Temur Square",
"MY HOME")
@iUmarov
iUmarov / tashkent_map.r
Created November 21, 2017 10:15
4 types of map view
#install.packages("ggmap")
#install.packages("gridExtra")
library(gridExtra)
library(ggmap)
map1 <- get_map("Tashkent", zoom = 11, maptype = "satellite", source = "google")
map2 <- get_map("Tashkent", zoom = 11, maptype = "roadmap", source = "google")
map3 <- get_map("Tashkent", zoom = 11, maptype = "terrain", source = "google")
map4 <- get_map("Tashkent", zoom = 11, maptype = "hybrid", source = "google")
@iUmarov
iUmarov / Starbucks_near_ohio.R
Created November 21, 2017 10:16
Starbucks near Ohio state
#install.packages("googleway")
library(googleway)
key <- 'AIzaSyCOEzgiO1P6trrSmu9vy9ZVuQDkog6Lwiw'
df_places <- google_places(search_string = "Starbucks",
location = c(40.417287, -82.907123),
key = key)
df_places$results$formatted_address
import android.content.Context;
import android.widget.Toast;
import com.drojj.javatests.R;
import com.google.firebase.FirebaseApiNotAvailableException;
import com.google.firebase.FirebaseException;
import com.google.firebase.FirebaseNetworkException;
import com.google.firebase.FirebaseTooManyRequestsException;
import com.google.firebase.auth.FirebaseAuthException;
@iUmarov
iUmarov / godmode_indicator
Last active June 20, 2023 18:54
GodMode Indicator in Python
# This is a non-multiexchange version of GODMODE indicator
# If you want the multi exchange version of GODMODE indicator, you need to implement willy and csi calculations too
# Original source of god mode indicator:
# https://www.tradingview.com/script/oA3U7pok-GODMODE-OSCILLATOR-FRESH-BREAD-GENERATOR-FREE-TO-USE/
import pandas as pd
import talib
channel_length = 9
average_length = 26