Skip to content

Instantly share code, notes, and snippets.

View john1jan's full-sized avatar

John Francis john1jan

View GitHub Profile
@john1jan
john1jan / RupeeTextView.java
Last active June 12, 2019 12:08
RupeeTextView . Which Prefixes ₹ symbol and adds commas separated amount value
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
import com.billion.grow.logger.Log;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
@john1jan
john1jan / PrefKeys.java
Last active February 16, 2022 23:45
Utils class for storing and retrieving data from SharedPreference in Android
/**
* Created by john.francis on 24/05/16.
*/
public class PrefKeys {
public static final String USER_INCOME = "USER_INCOME";
public static final String USER_MARITAL_STATUS = "USER_MARITAL_STATUS";
public static final String USER_SALARY_FLOAT= "USER_SALARY_FLOAT";
public static final String USER_SALARY_LONG= "USER_SALARY_LONG";
public static final String USER_AGE= "USER_AGE";
}
@john1jan
john1jan / sample.js
Last active March 20, 2017 12:47
Binding Method using React.createClass
var Sample = React.createClass({
getInitialState() {
return { message: 'Hello world' };
},
print() {
console.log(this.state.message);
},
render() {
@john1jan
john1jan / BindingSample1.js
Created March 20, 2017 12:47
Binding Explained
var Sample1 = React.createClass({
print(message) {
console.log("Hello " + message);
},
render() {
return (
<input type="button" value="Print" onClick={this.print("Mars")} />
);
@john1jan
john1jan / BindingSample2.js
Last active March 20, 2017 13:11
BindingSample2
var Sample = React.createClass({
getInitialState() {
return {
message: "Hello World"
}
},
print() {
console.log(this.state.message);
@john1jan
john1jan / ArrowSample.js
Created March 20, 2017 13:22
ArrowSample
var Sample = React.createClass({
printMars(message) {
console.log("Hello " + message);
},
render() {
return (
<div>
@john1jan
john1jan / ES6Sample.js
Created March 20, 2017 14:51
ES6Sample
class App extends React.Component {
constructor(props) {
super(props);
this.state = { message: 'Hello World' };
}
render() {
return <div>
<p> Binding Revealed</p>
@john1jan
john1jan / ConstructorBindingSample.js
Created March 20, 2017 15:07
ConstructorBindingSample
class App extends React.Component {
constructor(props) {
super(props);
this.state = { message: 'Hello World' };
this.print = this.print.bind(this);
}
render() {
return <div>
@john1jan
john1jan / ParamConstBinding.js
Created March 20, 2017 15:27
ParamConstBinding
class App extends React.Component {
constructor(props) {
super(props);
this.state = { message: 'Hello ' };
this.print= this.print.bind(this);
}
render() {
return <div>
@john1jan
john1jan / Parent.js
Last active March 20, 2017 15:57
Parent Child
class Parent extends React.Component {
constructor(props) {
super(props);
this.state = { message: 'I am parent ' };
this.printParent = this.printParent.bind(this);
}
render() {
return <div>