Skip to content

Instantly share code, notes, and snippets.

@josephkandi
josephkandi / Animation Fade
Created May 30, 2019 06:31 — forked from aloisdeniel/Animation Fade
Xamarin.iOS view common animations
public static void Fade (this UIView view, bool isIn, double duration = 0.3, Action onFinished = null)
{
var minAlpha = (nfloat)0.0f;
var maxAlpha = (nfloat)1.0f;
view.Alpha = isIn ? minAlpha : maxAlpha;
view.Transform = CGAffineTransform.MakeIdentity ();
UIView.Animate (duration, 0, UIViewAnimationOptions.CurveEaseInOut,
() => {
view.Alpha = isIn ? maxAlpha : minAlpha;
@josephkandi
josephkandi / eslint
Created July 31, 2018 07:45
ESLint config with babel-parser
module.exports = {
"parser": "babel-eslint",
"extends": "airbnb",
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
},
"env": {
"browser": true
}
};
var auth2;
var loggedInPara = document.getElementById('login-status');
gapi.load('auth2', function(){
auth2 = gapi.auth2.init({
client_id: 'app-id.apps.googleusercontent.com'
});
loggedInPara.textContent = (auth2.isSignedIn.get()) ? 'User is logged in' : 'User is logged out';
auth2.attachClickHandler('signin-button', {}, onSuccess, onFailure);
});
class StringDemo {
public static void main (String[] args) {
//The String data type is used to hold a sequence of characters
//We use double quotes to enclose the value of the String
String username = "joseph";
String email = "john.doe@example.com";
System.out.println("username " + username);
String firstName = "Joseph";
String lastName = "Kandi";
class DoubleDemo {
public static void main (String[] args) {
//A double type holds a floating point number
//A double is a 64-bit precision floating point number
//Use double type for high precesion floating point types
double averageScore = 550.50;
System.out.println("averageScore " + averageScore);
//We can also prefix it with a D or d but a floating point literal is automatically a double value
double totalScore = 975.05D;
class FloatDemo {
public static void main (String[] args) {
//A float type holds a floating point number
//A float is a 32-bit precision floating point number
//The float value should be prefixed with an F or f
//If you need very high precision you should use a double data type instead
float averageScore = 550.50F;
float totalScore = 975.05f;
System.out.println("averageScore " + averageScore);
System.out.println("totalScore " + totalScore);
class BooleanDemo {
public static void main (String[] args) {
//boolean type hold the value of either true or false
boolean loggedIn = true;
System.out.println("loggedIn " + loggedIn);
//when using boolean types, the convention is to use is before the variable name
boolean isAuthenticated = false;
System.out.println("isAuthenticated " + isAuthenticated);
class CharDemo {
public static void main (String[] args) {
//The char data type is represented internally as a number
//It holds a single unicode character
char correctAnserOption = 'A';
//The unicode value for the @ sign is 64.
char atSign = 64;
System.out.println(atSign);
//You can also use it to display non-printable characters
class LongDemo {
public static void main (String[] args) {
//Use the long type for storing numbers greater than the int type maximum value
//It can store values in the range -9.22337203685478E18 to 9.22337203685478E18
//This is a huge number, use this if you really need to, otherwise use int type
//For values within the int type range, you don't need anything special
long maximumCharacters = 140;
System.out.println("maximumCharacters " + maximumCharacters);
//You will need to add the L suffix for any numbers less than or greater the int min or max range
class IntDemo {
public static void main (String[] args) {
////The int type stores values in the range -2147483648 to 2147483647
//The Java compiler is optimized to use the int type
//Choose int type when you need a number without a decimal place as your default
int currentUsersOnline = 2147483647;
System.out.println("currentUsersOnline " + currentUsersOnline);
//TODO
//Try changing the value of currentUsersOnline to 2147483648