Skip to content

Instantly share code, notes, and snippets.

Ben Bailey benfb

Block or report user

Report or block benfb

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
@benfb
benfb / stonednerdkitty
Created Apr 3, 2011
The kitty says 'still alive.'
View stonednerdkitty
Tonight I decided to set something interesting to happen every time I open the Terminal.
I decided to use cowsay (http://www.nog.net/~tony/warez/cowsay.shtml)
and fortune (http://en.wikipedia.org/wiki/Fortune_(Unix) to have a "cow" (kitten in my case)
give out random quotes from Portal, the Hitchhiker's Guide to the Galaxy and Monty Python and the Holy Grail.
I was successful, and decided to share my method.
First, you should install both programs:
brew install fortune
brew install cowsay
@benfb
benfb / restaurbot.rb
Created Aug 5, 2011
A simple restaurant robot
View restaurbot.rb
# Restaurbot
$done = false
orders = [
'pizza', 'macaroni'
]
puts 'Hello. What is your name?'
$name = gets.chomp.capitalize
View iAopen.sh
#!/bin/bash
open -A /Applications/iA\ Writer.app/ $1
@benfb
benfb / BBaileyDateable.java
Last active Oct 10, 2015
i/o and variables
View BBaileyDateable.java
// name:
// purpose: determine minimum age of a possible date
import java.util.Scanner; // imports the "Scanner" library, which allows the program to set up a new Scanner object
public class BBaileyDateable
{
// method main(): program starting point
public static void main( String[] args )
{
View Turtle.java
import java.util.*;
import java.awt.*;
import java.io.*;
/**
* Class that represents a turtle which is similar to a Logo turtle.
* This class inherts from SimpleTurtle and is for students
* to add methods to.
*
* Copyright Georgia Institute of Technology 2004
View TurtleRunner.java
public class TurtleRunner
{
public static void main(String args[])
{
//create a world for your turtles
World turtleWorld = new World(600,800); //creates the turtle canvas
//create a picture
Picture turtle = new Picture("images.jpg"); //lets java know where the picture is
View BBaileyInvoke.java
// name:
// purpose: demonstrate further method prowess
public class BBaileyInvoke
{
// method piggyBank(): returns what the change is worth in cents
public static int piggyBank(int pennies, int nickles, int dimes, int quarters, int halfDollars) //creates the piggyBank method, which takes the arguments pennies, nickles, dimes, quarters, and halfDollars
{
double money = (pennies *.01) + (nickles*.05) + (dimes*.1) + (quarters*.25) + (halfDollars*.5); //calculates the amount of money needed
View BBaileyBook.java
public class BBaileyBook //the name of the class should be "Book"
{
private String bookName; //the variables need to be private because they are instance variables
private int bookISBN; //you don't need to assign default values because they are assigned in the constructors
public BBaileyBook(){ //default constructor named book that should provide default values ("" and 0, respectively) for the instance variables
bookName = ""; //when no arguments are passed, the title defaults to ""
bookISBN = 0; //when no arguments are passed, the ISBN defaults to 0
}
public BBaileyBook(String name, int isbn){ //creates a book object and assigns the name and isbn arguments to the instance variables
View BBaileyBookRunner.java
public class BBaileyBookRunner
{
public static void main(String args[])
{
BBaileyBook textBook = new Book(); //creates a new object textbook of class Book
textBook.setName("Scooby Doo"); //sets the name of textBook to "Scooby Doo"
textBook.getName(); //println would print default values if the default constructor was called. In this case, the output matches the input
System.out.println(textBook); //What does this line do? It calls the .toString() method
BBaileyBook theStranger = new Book("The Stranger", 123456789); //creates a new book with title "The Stranger" and ISBN 123...
System.out.println(textBook.getName); //prints textBook's name
View InOrder.java
public class InOrder //creates the InOrder class
{
private int numOne; //creates the instance variable numOne
private int numTwo; //creates the instance variable numTwo
private int numThree; //creates the instance variable numThree
boolean b = false; //creates the boolean value b (not instance)
public InOrder() //default constructor
{ //assigns default values to instance variables
numOne = 0;
You can’t perform that action at this time.