Skip to content

Instantly share code, notes, and snippets.

View sharvankumar's full-sized avatar

Sharvan Kumar sharvankumar

View GitHub Profile
@sharvankumar
sharvankumar / Option A
Created November 23, 2015 04:08 — forked from udacityandroid/Option A
Android Development for Beginners : Calculate the Price Method
/**
* Calculates the price of the order based on the current quantity.
*
* @return the price
*/
private int calculate price(int quantity {
int price = quantity * 5;
return price;
}
@sharvankumar
sharvankumar / Method 1
Created November 23, 2015 10:25 — forked from udacityandroid/Method 1
Android Development for Beginners : Define a Method
private String createCalendarEventReminder(String eventName, String location, int minutesAway) {
String reminder = "You have an upcoming event in " + minutesAway + " minutes.";
reminder = reminder + " It is " + event + " held at " + location + ".";
return reminder;
}
@sharvankumar
sharvankumar / Code snippet in SmoothieActivity.java
Created November 30, 2015 00:57 — forked from udacityandroid/Code snippet in SmoothieActivity.java
Android for Beginners : If/Else Smoothie Quiz
int numberOfSmoothiesTillPrize = 10;
if (numberOfSmoothiesTillPrize > 9) {
Log.v("SmoothieActivity", "Congratulations, you get a free smoothie!");
numberOfSmoothiesTillPrize = numberOfSmoothiesTillPrize - 10;
} else {
Log.v("SmoothieActivity", "No free smoothie this time.");
}
Log.v("SmoothieActivity", "You currently have " + numberOfSmoothiesTillPrize + " out of 10 smoothies needed for your next free smoothie.");
@sharvankumar
sharvankumar / Code snippet from MainActivity.java
Created December 3, 2015 09:15 — forked from udacityandroid/Code snippet from MainActivity.java
Android for Beginners : Negative Number of Cups of Coffee Extra Challenge Solution
/**
* This method is called when the plus button is clicked.
*/
public void increment(View view) {
if (quantity == 100) {
// Show an error message as a toast
Toast.makeText(this, "You cannot have more than 100 coffees", Toast.LENGTH_SHORT).show();
// Exit this method early because there's nothing left to do
return;
}
@sharvankumar
sharvankumar / dates.js
Created August 19, 2019 00:36 — forked from wizard04wsu/dates.js
JavaScript Date methods
//month names, weekday names, and ordinal indicators are in English
// Date.now()
// Date.fromISOString(isoStr)
// Date.timeBetween(date1, date2)
// dat.isLeapYear()
// dat.isUTCLeapYear()
// dat.getDaysInMonth()
// dat.getUTCDaysInMonth()
// dat.getMonthName()
from flask import Flask
from flask_restful import Api, Resource, reqparse
app = Flask(__name__)
api = Api(app)
users = [
{
"name": "Nicholas",
"age": 42,