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);
});
//This is a comment and will be ignored by the Java compiler
//The program is fully editable
//Try changing the 'Hello World, I'm a Java program'
//to your name and click the Run button
public class HelloWorld {
//This is the main function of a Java program.
//String[] is an array of strings.
//The variable args will contain command line arguments passed to the program
public static void main (String[] args) {
//The System.out.println() is used to print output to the console
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 NumericsDemo {
public static void main (String[] args) {
//The numeric types store numbers without decimal places
//The byte store values in the range from -128 to 127
byte maximumUsersPerGroup = 120;
System.out.println("byte " + maximumUsersPerGroup);
//Try changing the value of maximumUsersPerGroup to 128 and Run again
//short type stores values in the range from -32768 to 32767
short maximumMessageLength = 5000;
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