Skip to content

Instantly share code, notes, and snippets.

View shangeethsivan's full-sized avatar
🧩
Programmer by Profession, Problem Solver by Heart

Shangeeth Sivan shangeethsivan

🧩
Programmer by Profession, Problem Solver by Heart
  • Chennai
View GitHub Profile
@shangeethsivan
shangeethsivan / OperatorOverloading.kt
Created August 4, 2024 09:18
Operator Overloading in Kotlin
fun main() {
val state = State.DataLoaded
val newState = state + UserInputs.OnRetryClick
println(newState)
}
sealed class State{
abstract operator fun plus(userInputs: UserInputs): State
object DataLoaded : State() {
@shangeethsivan
shangeethsivan / gist:6663c534a33787001abf6fe77366cb42
Created August 20, 2019 11:11
Status bar transparent android
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
mTopPanel.animate().translationY(0);
mTopPanel.animate().translationY(500);
// Sample code to measure code execution time.
void onBindViewHolder(){
long startTime = System.currentTimeMillis();
// Your code
long endTime = System.currentTimeMillis();
#
# Sample CircleCI 2.0 configuration for Android
#
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-28
environment:
import org.webrtc.EglBase;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/*
* Uses reflection to interact with non public class EglBaseProvider.
*/
public class EglBaseProviderReflectionUtils {
@shangeethsivan
shangeethsivan / DateinFormat.java
Created January 27, 2017 13:10
Date Format in java
Date d=new Date();
SimpleDateFormat sdf=new SimpleDateFormat("dd:MM:yyyy hh:mm:ss");
String date=sdf.fomat(date);
@shangeethsivan
shangeethsivan / readFile.java
Created January 27, 2017 12:16
Reading Data From a Fle
Scanner sn=null;
try{
sn=new Scanner(new File("c://file.txt"));
}
catch(Exception e){
}
while(sn.hasNextLine()){
String line=sn.nextLine();
String datas[]=line.split(";");// If data in split
System.out.println("Name"+data[0]+"Number"+data[1]);
@shangeethsivan
shangeethsivan / filewrite.java
Last active January 27, 2017 10:16
File Operation in Java Writing data
File f=new File("C://new.txt");
FileWriter fw=null;
BufferedWriter bw=null;
String data="Data to be stored in new.txt";
if(!f.exists()){
try{
f.createNewFile();
}
catch(Exception e){
System.out.println(e.getMessage());
@shangeethsivan
shangeethsivan / SetFillW
Last active January 1, 2017 10:05
SetFill and Set W
std::cout << std::setfill ('*') << std::setw (10);
std::cout << 5 <<std::endl;