Skip to content

Instantly share code, notes, and snippets.

@labe
labe / battleship_v1.0
Created April 23, 2013 03:00
Battleship!!! v1.0
#7 ships are only placed horizontally
#7 ships are placed at random by the computer on both boards
#future features:
# -ability to manually place ships
# -ability to place (manually and automatically) ships vertically
# -ability to manually choose coordinates for salvos
# -ability to dictate players (human vs human, human vs computer, computer vs computer)
class Battleship
@labe
labe / battleship.rb
Last active December 16, 2015 15:39
Battleship!: The Console Game (as best conceived by someone who has never played a game of Battleship in real life and who never saw the movie, but who HAS actually BEEN on battleships, albeit retired ones)
# only 5 ships are placed
# Board is printed with headers and is formatted for spacing
# ability to manually place ships horizontally
# ability to manually choose coordinates for salvos
# ability to dictate player types (human vs human, human vs computer, computer vs computer)
# only show players' boards at end of game
# if player is human, show opponent's board with previous attack attempts marked // DONE
# update the board to show attempted tiles // DONE
# translate letters to values ("A1" should -> (0,0)) // DONE
# if either player is a human, enter key must be pressed between turns (makes gameplay easier to follow) // DONE
@labe
labe / balance.txt
Last active June 28, 2023 17:13
For @dhouk24, our resident gambling squirrel. (end of week 2 @ dbc)
20.00
@labe
labe / index.html
Last active December 17, 2015 15:59 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@labe
labe / zoo.js
Last active December 17, 2015 16:08 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
function Animal(name, legs) {
this.name = name;
this.legs = legs;
}
Animal.prototype = {
@labe
labe / (data)bass_drops.rb
Last active December 17, 2015 20:29
keep your stress in check when you realize for the billionth time that your table schema is wrong.
#check it
print "\e[H"
print "\e[2J"
print "\e[5m"
2.times do
puts "
### #### #### # # # ### ##### # # ##### #####
# # # # # # # # # # # # # #
# # #### #### # # # # # # #### # #
# # # # # # # # # # # # # # #
@labe
labe / Creating_User_Accounts_in_Sinatra.md
Last active October 27, 2022 04:24
Creating user accounts with Sinatra (no BCrypt)

##User accounts with Sinatra (no BCrypt)

Create migration

A very basic schema for a user typically looks like this:

def change
  create_table :users do |t|
 t.string :username
@labe
labe / cl_git.md
Last active December 23, 2015 06:59
Submitting challenges to Socrates using command-line git

##Using git from the command line to submit Socrates challenges

###Downloading the gist

@labe
labe / README.md
Last active December 23, 2015 23:09
cookies and ovens and bakers and more!

##Getting started

  • Fork this gist
  • Clone your forked copy onto your local machine
  • Open the files in your text editor
  • $ ruby tests.rb

##Procedure

  • Read the error message