Skip to content

Instantly share code, notes, and snippets.

View mehagel's full-sized avatar

Mark E Hagel mehagel

  • Melissa Data
  • Canby, OR
View GitHub Profile
def tic_tac_toe
b=[]
a=["x", "o", "x", "o", "x", "x", "o", "x", "o"]
1.upto(10) do
tic_tac_toe = a.sample(9)
p board_grid = Array.new(3) { tic_tac_toe.shift(3) }
end
end
p tic_tac_toe
@mehagel
mehagel / index.html
Last active December 19, 2015 19:19 — forked from dbc-challenges/index.html
4_CSS_Layout
<!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>
@mehagel
mehagel / gist:5953394
Created July 8, 2013 23:33
Poll Database
Last login: Mon Jul 8 14:09:11 on ttys000
apprentice@dbc07 ~ $ cat << EOF > ~/.sqliterc
> .headers on
> .mode column
> EOF
apprentice@dbc07 ~ $ sqlite3 dummy.rb
-- Loading resources from /Users/apprentice/.sqliterc
SQLite version 3.7.15.1 2012-12-19 20:39:10
Enter ".help" for instructions
@mehagel
mehagel / P8 database Schema
Created July 7, 2013 18:40
P8: Database Schema : Poll Challenge
http://min.us/lbuwvg67CwwHkU
<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, http://code.google.com/p/wwwsqldesigner/ -->
<!-- Active URL: http://socrates.devbootcamp.com/sql.html -->
<sql>
<datatypes db="mysql">
<group label="Numeric" color="rgb(238,238,170)">
<type label="Integer" length="0" sql="INTEGER" re="INT" quote=""/>
<type label="Decimal" length="1" sql="DECIMAL" re="DEC" quote=""/>
module Functions
def drive
@status = :driving
end
def needs_gas?
return [true,true,false].sample
end
end
@mehagel
mehagel / performance
Created June 29, 2013 18:36
performance journeling
Lanny Bassham, a World Champion and Olympic Gold Medalist rifleman, wrote a pretty good book on performing at a high level, called With Winning in Mind.
In it, he recommends keeping a performance journal for each of your practice sessions.
A perforamnce journal is:
A way to measure and record your progress
First, because you cannot manage what you do not measure.
Second, because without one you are wasting a lot of time because without if you dont know what is going onw ith your performance.
I believe that the primary benefit of a performance journal is to build Self-Image.
@mehagel
mehagel / gist:5892147
Created June 29, 2013 18:27
flow control
flow control# uncomment each of the following comments individually
# to see how break, next, and return affect loop control flow.
def looper
i = 0
while i < 20
i += 1
break if i == 9 #"Print out to the screen 1..8 than done with loop followed by HA"
# next if i.even? # "Prints out to the screen odd number between 1..19 than HA! then prints DONE!"
# return if i == 9 # "Print out to the screen 1..8 than done with loop followed by HA" The same as line 8
@mehagel
mehagel / p3_nested_array.rb
Created June 13, 2013 05:38
p3 Nested Array
def tic_tac_toe
a=["x", "o", "x", "o", "x", "x", "o", "x", "o"]
1.upto(10) do
tic_tac_toe = a.sample(9)
p board_grid = Array.new(3) { tic_tac_toe.shift(3) }
end
end
p tic_tac_toe
class Car
@@WHEELS = 4
def initialize(args)
@color = args[:color]
@wheels = @@WHEELS
end
def drive
@status = :driving
end
def brake
def to_roman(num)
words=''
romans = {
1000=>'M',
900=>'CM',
500=>'D',
400=>'CD',
100=>'C',
90=>'XC',
50=>'L',