Skip to content

Instantly share code, notes, and snippets.

View tahseenbokhari's full-sized avatar

Tahseen Bokhari tahseenbokhari

View GitHub Profile
@tahseenbokhari
tahseenbokhari / flower-power.py
Created July 31, 2016 17:26 — forked from mrosata/flower-power.py
Python Turtle Flower... Stack like recursion
#!/usr/bin/python
# Udacity exercise. Just posted the code here to help anyone who wanted to see the work behind my posted result.
__author__ = 'Michael Rosata mrosata1984@gmail.com'
__package__ = ''
from random import random
import turtle
class TurtleArtist(turtle.Turtle):
_origin = (0, 0)
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.");
int numberOfEmailsInInbox = 0;
int numberOfDraftEmails = 2;
String emailMessage = "You have " + numberOfEmailsInInbox + " emails. ";
String draftMessage = "You have " + numberOfDraftEmails + " email drafts.";
if (numberOfEmailsInInbox == 0) {
emailMessage = "You have no new messages. ";
}
if (numberOfDraftEmails == 0) {
draftMessage = "You have no new drafts.";
@tahseenbokhari
tahseenbokhari / Calculate Price Method.java
Last active July 25, 2016 18:30
Method showing how to calculate price
/**
* Calculates the price of the order based on the current quantity.
*
* @return the price
*/
private int calculatePrice(int price]) {
int calculatePrice = price * 5;
return calculatePrice;
}
@tahseenbokhari
tahseenbokhari / Court Counter.xml
Created July 24, 2016 16:44
When I apply the view tag in nested LinearLayout, it stops displaying everything on the screen. Can anybody help me out?
<view android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@android:color/darker_gray"
android:layout_marginTop="16dp"/>