Skip to content

Instantly share code, notes, and snippets.

View mayuroks's full-sized avatar

Mayur Rokade mayuroks

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/tvStatus"
@mayuroks
mayuroks / vairables.kt
Created August 23, 2018 15:46
Kotlin variables
// Use var to declare a variable, whose value can be changed later
var b: String = "Wow"
// val in Kotlin is same as final in Java
val a: Int = 0
// To initialize a variable as null
var c: String? = null
// Initialize a variable later in the code using lateInit
open class Animal { // Parent class
var name: String? = null // Nullable variable
var legs: Int = 0 // Non-nullable variable
lateinit var map: HashMap<Integer, String> // Variable inited later in the code
constructor(legs: Int) {
this.legs = legs
}
constructor(legs: Int, name: String) {
@mayuroks
mayuroks / YouTubeHelper.java
Last active October 11, 2018 19:55 — forked from jvanderwee/YouTubeHelper.java
Extract video id from YouTube url in java
import com.google.inject.Singleton;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Singleton
public class YouTubeHelper {
final String youTubeUrlRegEx = "^(https?)?(://)?(www.)?(m.)?((youtube.com)|(youtu.be))/";
final String[] videoIdRegex = { "\\?vi?=([^&]*)","watch\\?.*v=([^&]*)", "(?:embed|vi?)/([^/?]*)", "^([A-Za-z0-9\\_-]*)"};
package com.example.sigsegvapp
/*
* Notes:
*
* OpWeight function to get weight of an op
* Max function to return highest of two ops
*
* Evaluate entire string for all operators
* Save highest and leftmost operator