Skip to content

Instantly share code, notes, and snippets.

View sigmadeltasoftware's full-sized avatar
🎯
Focus.

Bojan Belic sigmadeltasoftware

🎯
Focus.
View GitHub Profile
@sigmadeltasoftware
sigmadeltasoftware / app_src_debug_AndroidManifest.xml
Created March 19, 2024 15:35
Send mock push notifications to a locally (rooted) device
<!-- NOTE: REPLACE THE CATEGORY WITH YOUR OWN PACKAGE NAME -->
<!-- Don't include this receiver in your main AndroidManifest as it's a security hazard -->
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true"
android:permission="@null"
tools:replace="android:permission">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="some.randome.packagename" />
@sigmadeltasoftware
sigmadeltasoftware / gist:6ec88fc30f671efeac3779e8bd6c56fe
Created November 19, 2020 15:08
Compilation failure for Jetbrains Compose with Kotlinx.Serialization annotation
----------
sealed class ApiResponse<T> {
@Serializable data class Success<T>(val body: T) : ApiResponse<T>()
data class Error<T>(val error: Throwable? = null) : ApiResponse<T>()
}
----------
> Task :common:compileKotlinDesktop FAILED
@sigmadeltasoftware
sigmadeltasoftware / ModalBottomSheetDialogFragment.kt
Last active February 27, 2020 06:09
ModalBottomSheetDialogFragment
package be.sigmadelta.template.common.presentation
import android.content.Context
import android.content.res.Configuration
import android.util.DisplayMetrics
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.fragment.app.FragmentManager
@sigmadeltasoftware
sigmadeltasoftware / PersonModel.java
Created December 26, 2017 20:58
IAA_2: Person entity
public class Person {
private String _firstName;
private String _lastName;
private int _age;
private Address _address;
public Person(String firstName, String lastName, int age, Address address) {
_firstName = firstName;
_lastName = lastName;
@sigmadeltasoftware
sigmadeltasoftware / GreetingsLanguage.java
Created December 26, 2017 20:50
IAA_2: GreetingsRepository good
public enum GreetingsLanguage {
FRENCH("Bonjour "),
ENGLISH("Hello "),
DUTCH("Hallo ");
private String _greeting;
GreetingsLanguage(String greeting) {
_greeting = greeting;
}
@sigmadeltasoftware
sigmadeltasoftware / GreetingsRepository.java
Created December 26, 2017 20:48
IAA_2: GreetingsRepository bad
public class GreetingsRepository {
public String getFrenchGreeting(String name) {
if (name == null || name.equals("")) {
Log.e("GreetingsRepository", "name: " + name + " is invalid!");
return null;
}
return "Bonjour " + name + "!";
}
@sigmadeltasoftware
sigmadeltasoftware / GetNextSize.java
Last active December 26, 2017 21:19
IAA_2: getNextSize clear
public static int getNextSize(int i) {
return Math.Abs(i * 4);
}
@sigmadeltasoftware
sigmadeltasoftware / GetNextSize.java
Last active December 26, 2017 21:19
IAA_2: convoluted getNextSize
public static int getNextSize(int i) {
//multiply it by four and make sure it is positive
return i > 0 ? i << 2 : ~(i << 2) + 1;
}
@sigmadeltasoftware
sigmadeltasoftware / CMakeLists.txt
Created March 23, 2017 13:45
Android Low-Latency Audio Post-Processing with Superpowered - CMakeLists.txt
cmake_minimum_required(VERSION 3.4.1)
# Create lists with all source files
file(GLOB jni_SRCS "${CMAKE_SOURCE_DIR}/src/main/jni/*.cpp")
file(GLOB vibrato_SRCS "${CMAKE_SOURCE_DIR}/src/main/jni/Vibrato-effect/BerVibrato/*.cpp")
# Default flags
set_property(SOURCE ${jni_SRCS}
APPEND_STRING PROPERTY COMPILE_FLAGS "-O3")
@sigmadeltasoftware
sigmadeltasoftware / SuperpoweredRenderer.cpp
Last active March 23, 2017 13:30
Android Low-Latency Audio Post-Processing with Superpowered - SuperpoweredRenderer::process() method
bool SuperpoweredRenderer::process(short int *output, unsigned int numberOfSamples) {
bool silence = !audioPlayer->process(stereoBuffer, false, numberOfSamples);
if (!silence) {
/*****************************
* APPLY PROCESSING BELOW
*/
const int nrChannels = 2;
for (int i = 0; i < numberOfSamples * nrChannels; ++i) {
stereoBuffer[i] = vibrato.processOneSample(stereoBuffer[i]);