Skip to content

Instantly share code, notes, and snippets.

View rajajawahar's full-sized avatar
🏠
Working from home

Raja Jawahar rajajawahar

🏠
Working from home
View GitHub Profile
/*
* Copyright (C) 2013 Tomáš Procházka
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
public class MainActivity extends AppCompatActivity {
public static class Shop {
public int id;
public String name;
public List<Coordinate> coordinates = new ArrayList<>();
@Override
public String toString() {
String str = id + " (" + name + ") [ ";
@rajajawahar
rajajawahar / ApiModule.java
Created October 23, 2017 09:03 — forked from koesie10/ApiModule.java
Retrofit 1 error handling behaviour in Retrofit 2
// Dagger 1 example
@Module(
complete = false,
library = true
)
public final class ApiModule {
@Provides
@Singleton
Retrofit provideRetrofit(Gson gson, Application app) {
return new Retrofit.Builder()
//http://stackoverflow.com/questions/2422383/uinavigationbar-multi-line-title
private func setupTitleView() {
let topText = NSLocalizedString("key", comment: "")
let bottomText = NSLocalizedString("key", comment: "")
let titleParameters = [NSForegroundColorAttributeName : UIColor.<Color>(),
NSFontAttributeName : UIFont.<Font>]
let subtitleParameters = [NSForegroundColorAttributeName : UIColor.<Color>(),
NSFontAttributeName : UIFont.<Font>]
@rajajawahar
rajajawahar / ChangePassword.java
Created February 1, 2018 12:55 — forked from zach-klippenstein/ChangePassword.java
The keystore password on Java keystore files is utterly pointless. You can reset it without knowing it, as shown by this code. Note that private keys are still secure, as far as I know. The JKS implementation is copyright Casey Marshall ([email protected]), and the original source is available at http://metastatic.org/source/JKS.java. I've in…
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{
@rajajawahar
rajajawahar / gist:d6c4b9d47ac54ba0ab38576d1fc035d6
Created February 3, 2018 10:43
Change the textview attributes programatically while clicking
TextView textView = new TextView(this);
textView.setText("Test");
textView.setId("Your Id");
textView.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View view) {
changeTextViewAttributes()
}
});
RelativeLayout.LayoutParams layoutParams =
new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
class Employee: NSObject {
var employeeName : String?
var employeeId : String?
}
class ConcatOperator {
var disposeBag : DisposeBag = DisposeBag()
func getEmployeeData(){
getEmployeeFromCacheAndFallBackToOnline()
.subscribe(onNext: { (goodReceiptPOList) in
print(goodReceiptPOList.count)
}, onError: {
(error) in
public class BatteryLowReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BATTERY_LOW)) {
//Battery Level Notificaiton
}
}
}
<receiver android:name=".BatteryLowReceiver">
<intent-filter>
<action android:name="android.intent.action.BATTERY_LOW" />
</intent-filter>
</receiver>