Skip to content

Instantly share code, notes, and snippets.

View acideater's full-sized avatar
🐀

Ana Paula acideater

🐀
View GitHub Profile
@acideater
acideater / countBlocks.java
Created May 26, 2018 20:21
Program that used for loop to count numbers of blocks in a pyramid.
public int countBlocks(int levels) {
int total = 0;
for (int i=1; i<=levels; i++){
total = total + (i*i);
}
return total;
}
//Roll a Yahtzee
public int keepRolling() {
int dice1 = rollDice();
int dice2 = rollDice();
int dice3 = rollDice();
int dice4 = rollDice();
int dice5 = rollDice();
int count = 1;
while (!(dice1 == dice2 && dice2 == dice3 && dice3 == dice4 && dice4 == dice5)) {
//we need to re-roll
@acideater
acideater / example_of_intents.java
Created May 19, 2018 15:12
Implicit and Explicit Intents examples.
// Implicit intent
public void submitOrder(View view) {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:justjava@justjavacoffee.com")); // only email apps should handle this
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.order_summary_email_subject, name));
intent.putExtra(Intent.EXTRA_TEXT, priceMessage);
@acideater
acideater / string.xml
Created March 26, 2018 01:52
Android for Beginners : Brazilian Portuguese Localization
<?xml version="1.0" encoding="utf-8"?>
<!--
Brazilian Portuguese Localization file for Android App Just Java
path: res/values-pt-rBR/strings.xml
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="hello_world">Olá Mundo!</string>
@acideater
acideater / jam.py
Created March 16, 2018 03:41
Let's Jam
count = 3
print "Ok."
while (count > 0):
print count
count = count - 1
print "Let's Jam!"
@acideater
acideater / janken.py
Created March 16, 2018 03:36
Python simple Janken Game
from random import randint
print("#########################################")
print("Let's play Rock, Paper Scissors!")
print("##########################################\n\n")
startGame = input("Shall we start?(y/n)\n")
while startGame == "y":
@acideater
acideater / trucopaulista.java
Created March 13, 2018 04:05
Truco Paulista - Score Keeper App
package com.example.android.trucopaulistacounter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
int scoreDuoOne = 0;