Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Saxman Andrelton

View GitHub Profile
@Andrelton
Andrelton / minimum.html
Created Dec 20, 2015
Bare-minimum HTML page with jquery and stylesheet/script tags.
View minimum.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Minimum html page.</title>
<meta charset="utf-8">
<link rel="stylesheet" href="index.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
@Andrelton
Andrelton / huffman.rb
Created Dec 5, 2015
Huffman Encoding Ruby Implementation
View huffman.rb
class Node
attr_reader :value, :left, :right
def initialize(value, left, right)
@value, @left, @right = value, left, right
end
end
class CountObject
attr_reader :char, :value
@Andrelton
Andrelton / hello_rack_app.rb
Created Nov 10, 2015
Simple Rack app as a Ruby file instead of config.ru.
View hello_rack_app.rb
# Start server from command line with 'rackup hello_rack_app.rb'
# Make a GET request to the localhost port with cURL or your browser
require 'rack'
class Hello
def self.call(env)
[
'200',
{ 'Content-type' => 'text/html' },
View CSV Notes
require 'csv'
friends = []
File.open("hamburgler.txt", 'r') do |f|
f.each_line { |line| friends << line.chomp }
end
p friends
File.open("helicopter.txt", 'w') do |f|
friends.each do |item|
View Recursive Boggle
def checker(board, word, last_idx = nil)
return true if word.empty?
#take letter from front of word
letter = word.slice!(0)
this_idx = []
# change last letter to "NO"
if last_idx
board[last_idx[:row]][last_idx[:column]] = "NO"
You can’t perform that action at this time.