Skip to content

Instantly share code, notes, and snippets.

View octopuscabbage's full-sized avatar
🔱

Chris Denniston octopuscabbage

🔱
  • University of Southern California
  • Los Angeles
  • 02:28 (UTC -07:00)
View GitHub Profile
pulic void getG(Graphics g){
this.g == g;
}
/**
* @(#)Pen.java
*
*
* @author
* @version 1.00 2013/4/25
*/
//free hand drawing
/**
* @(#)Main.java
*
*
* @author
* @version 1.00 2013/4/25
*/
import java.awt.*;
import java.applet.Applet;
if (dir == 1) { sprite = Sprite.player_side;
if (walking) {
frame = 1;
switch(frame)
case 1: sprite = Sprite.player_side_1;frame++;break;
case 2: sprite = Sprite.player_side_2;freme++;break;
case 3: sprite = Sprite.player_side_3;frame++;break;
case 4: sprite = Sprite.player_side_4;frame++;break;
case 5: sprite = Sprite.player_side_5;frame++;break;
case 6: sprite = Sprite.player_side_6; frame=1;
def acceptable_input(n):
'''This function determines wether or not the input is considered valid
based on wether it is a digit and also if typecasted to an int (a natural
number datatype) it is divisible by three '''
return (n.isdigit() and int(n) % 3 == 0)
def cube(n):
'''Tests if input is acceptable and returns the cube of n or -1 if it is not
@octopuscabbage
octopuscabbage / gist:6208260
Last active December 20, 2015 22:49
Beautifal soup test
from bs4 import BeautifulSoup
html_doc = """
<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and their names were
<a href="http://example.com/elsie" class="sister" id="link1">Elsie</a>,
<a href="http://example.com/lacie" class="sister" id="link2">Lacie</a> and
<a href="http://example.com/tillie" class="sister" id="link3">Tillie</a>;
@octopuscabbage
octopuscabbage / gist:6691964
Created September 24, 2013 22:04
fuckntiions lol
def hello(list_of_output,output=1):
if output == 1:
print(list_of_output[0])
elif output == 2:
print(list_of_output[1])
else:
print(list_of_output[2])
def how_many_bitches(name):
if name == "joao":
@octopuscabbage
octopuscabbage / gist:6744825
Created September 28, 2013 18:16
screw algebra
for percent_acid in range(0,101):
for acid_total in range(0,800*100):
for other_acid_total in range(0,800*100):
if .99*(518) + (percent_acid/100)*(acid_total/100) == .94 *(other_acid_total/100):
print('percent acid:', percent_acid/100,'acid total: ',acid_total/100,'other acid total: ',other_acid_total/100)
@octopuscabbage
octopuscabbage / gist:8778727
Created February 3, 2014 04:09
ascii formatter
program_words = open("main.cpp", 'r').read()
text_words = open("word.txt", 'r').readlines()
output_file = open("output.txt", 'w')
output_string = ""
program_words_index = 0
program_words = program_words.replace("\n","")
@octopuscabbage
octopuscabbage / gist:9167528
Created February 23, 2014 05:48
Grading function for Nathan
char grader(int grade){
if(grade >= 90)
return 'A';
else if ( grade >= 80)
return 'B';
else if (grade >= 70)
return 'C';
else if (grade >= 60)
return 'D';
return 'F';