Skip to content

Instantly share code, notes, and snippets.

franksands

Block or report user

Report or block franksands

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@franksands
franksands / gcs_list_files.py
Created Jan 24, 2020
list files in cloud store
View gcs_list_files.py
import os
import sys
import unittest
import cloudstorage
GOOGLE_APP_ENGINE_PATH = os.environ.get("GAE_PATH")
sys.path.append(GOOGLE_APP_ENGINE_PATH + 'lib/yaml-3.10')
from google.appengine.ext import testbed
View interfaces.java
public interface FlyingMonster {
public void fly(int speed);
}
public interface MagicMonster {
public void spendMana(int points);
}
View dragon.java
public class LivingThing() {
// ...other code in the class...
}
public class Dragon extends LivingThing {
// ...Dragon-specific code in the class...
}
View privateHealth.java
public class LivingThing {
public String name;
private int health;
//class other code
}
hero = LivingThing("Elsa", 50, 80, "Axe");
// ...some more code...
View healthError.java
class LivingThing() {
// ...code in the class...
}
hero = LivingThing("Elsa", 50, 80, "Axe");
// ...some more code...
if (someCondition) {
hero.health -= 50;
View damageMethod.java
public class LivingThing() {
// ...other code in the class...
public void takeDamage(int amount) {
this.health = this.health - amount;
if (this.health <= 0) {
print(this.name + " is dead!");
}
}
}
View takeDamage.java
public void takeDamage(livingThingObject, dmgAmount) {
livingThingObject.health = livingThingObject.health - dmgAmount
if (livingThingObject.health < 0) {
print(livingThingObject.name + ' is dead!')
}
}
hero = LivingThing("Elsa", 50, 80, "Axe");
takeDamage(hero, 10); // Elsa takes 10 points of damage
View message.java
hero = LivingThing("Elsa", 50, 80, "Axe");
hero.health -= 10; // Elsa takes 10 points of damage
if (hero.health < 0) {
print(hero.name + ' has died!')
}
View health.java
hero = LivingThing("Elsa", 50, 80, "Axe");
hero.health -= 10 // Elsa takes 10 points of damage
View hunger.java
public class LivingThing {
public String name;
public int health;
public int magicPoints;
public String attack;
public int hunger;
public LivingThing(String name, int health, int magicPoints, String attack) {
this.name = name;
this.health = health;
You can’t perform that action at this time.