Skip to content

Instantly share code, notes, and snippets.

@Andrelton
Andrelton / minimum.html
Created December 20, 2015 02:04
Bare-minimum HTML page with jquery and stylesheet/script tags.
<!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 December 5, 2015 02:35
Huffman Encoding Ruby Implementation
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 November 10, 2015 02:06
Simple Rack app as a Ruby file instead of config.ru.
# 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' },
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|
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"