This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> | |
<style type='text/css'> | |
html { margin: 0; padding: 0; } | |
body { margin: 0; padding: 30px; background: #049; font-family: Menlo, monospace; font-size: 11px; } | |
#container { width: 600px; margin: 0 auto; } | |
.red { background: #a00; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> | |
<style type='text/css'> | |
html { margin: 0; padding: 0; } | |
body { margin: 0; padding: 30px; background: #049; font-family: Menlo, monospace; font-size: 11px; } | |
#container { width: 600px; margin: 0 auto; } | |
.red { background: #a00; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Exam | |
attr_accessor :passes | |
attr_accessor :fails | |
def initialize(students) | |
@students = students | |
@passes = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words = File.open('/usr/share/dict/words').read | |
words.gsub!(/\r\n?/, "") | |
hashes = {} | |
anagrams = {} | |
most = 1 | |
most_anagram = '' | |
words.each_line do |word| | |
word = word.strip.downcase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# given an array of integers, find the largest value | |
def find_largest(numbers) | |
# initialize our "largest number" to the first number in the array | |
# because it is the largest so far | |
largest = numbers[0] | |
# looping over each number once | |
numbers.each do |i| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pg' | |
class Orm | |
@@conn = PG.connect( | |
dbname: 'dfq35t7uirbums', | |
port: 5432, | |
user: 'bmdjwluxchptuq', | |
host: 'ec2-54-204-41-178.compute-1.amazonaws.com', | |
password: 'aEH-cKdr2zoXYUAjI8Xjma5eXK' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r = { | |
"shrimp" => [ | |
"algae", | |
"other_shrimps", | |
"seaweed", | |
], | |
"toad" => [ | |
"children", | |
"flies", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<!-- we need to load jquery before we use it --> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<script> | |
// this code must run when the document is fully loaded | |
// otherwise we will try to bind events on elements that don't exist yet (html and code is parsed top to bottom) | |
$(document).ready( function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def maximum(numbers) | |
largest = numbers.first | |
index = 0 | |
# keep looping over every element in the array | |
while index < numbers.size | |
# check to see if current number is larger than the largest one so far |
OlderNewer