Skip to content

Instantly share code, notes, and snippets.

@sud007
sud007 / BillCalculatorMain.kt
Last active November 23, 2024 14:28
Electricity Bill Calculation for rental floors
/**
* You can edit, run, and share this code.
* play.kotlinlang.org
*/
fun calculateTotalUnits(unitsOld: Double, unitsNew: Double): Double {
return (unitsNew - unitsOld).roundToTwoDecimalPlaces()
}
fun calculatePerUnitPrice(amountTotal: Double, unitsTotal: Double): Double {
return (amountTotal / unitsTotal).roundToTwoDecimalPlaces()
@sud007
sud007 / android_build_pipeline.yaml
Last active March 12, 2024 08:20
Azure pipeline for Android MR
# Pipeline for develop staging and master branches
# Build the mobile app
# Distribution of release apk to App Center
# for staging, master deploy to play
trigger:
- develop
- staging
- release
- master
@sud007
sud007 / module.gradle
Created February 14, 2024 13:57
Sonarqube Gradle sample
apply(from = "../buildSrc/jacoco.gradle")
apply(from = "../buildSrc/sonarqube.gradle")
plugins {
id("org.sonarqube") version "3.3"
}
@sud007
sud007 / jacoco.gradle
Created January 16, 2024 06:46
Sample Jacoco Gradle : 2022
apply plugin: 'jacoco'
ext {
coverageExclusions = [
'**/src/main/res/**',
'**/R.class',
'**/*Activity*',
'**/*response*',
'**/*request*',
'**/*Util*',
@sud007
sud007 / Clock.ini
Created September 3, 2022 10:53
Rainmeter Clock ini file for adding rotation in Mond clock widget
[Rainmeter]
Update=1000
Author=Connect-R
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
AccurateText=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh]
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.5 ? 0.5 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.5 ? 0.5 : #Scale#-#ScrollMouseIncrement#)"][!Refresh]
LeftMouseDoubleClickAction=!ToggleConfig "Mond\Settings" "Settings.ini"
2021-01-19T16:17:38.6597310Z ##[section]Starting: env vars
2021-01-19T16:17:38.6608330Z ==============================================================================
2021-01-19T16:17:38.6608690Z Task : Bash
2021-01-19T16:17:38.6609000Z Description : Run a Bash script on macOS, Linux, or Windows
2021-01-19T16:17:38.6609290Z Version : 3.179.0
2021-01-19T16:17:38.6609550Z Author : Microsoft Corporation
2021-01-19T16:17:38.6609930Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
2021-01-19T16:17:38.6610350Z ==============================================================================
2021-01-19T16:17:44.2463050Z Generating script.
2021-01-19T16:17:44.2486270Z Script contents:
THis is temp file
nj3roinck9j w0e9fnki0pnoin 5M6viskg5NmY s-0nwniefp9nn
@sud007
sud007 / YourFragment.kt
Created February 26, 2019 07:16 — forked from rylexr/YourFragment.kt
Android navigation bar style with animation
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = DataBindingUtil.inflate(inflater, R.layout.your_fragment, container, false)
binding.homeAction.setOnClickListener { select(R.id.home_action) }
binding.likesAction.setOnClickListener { select(R.id.likes_action) }
binding.searchAction.setOnClickListener { select(R.id.search_action) }
binding.profileAction.setOnClickListener { select(R.id.profile_action) }
return binding.root
}
fun select(id: Int) {
PhoneStateListener phoneListener;
private void setupSignalStrength() {
final TelephonyManager manager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
phoneListener = new PhoneStateListener() {
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
if (manager.getNetworkOperator().equals("")) {
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// See https://github.com/AlstonLin/TheLearningLock/issues/54