Skip to content

Instantly share code, notes, and snippets.

View StephenFiser's full-sized avatar

Stephen Fiser StephenFiser

View GitHub Profile
<!doctype html>
<html>
<head>
<title>Hello!</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="./my_stuff.js"></script>
</head>
<body>
<h1>Hello World!</h1>
<div>
$(document).ready(function() {
alert("it's working!");
});
$(document).ready(function() {
$('h3').click(function() {
$(this).text("ehh... Maybe tomorrow");
});
});
$(document).ready(function() {
$('#new-to-do-item').keyup(function() {
alert("key pressed");
});
});
$(document).ready(function() {
$('#new-to-do-item').keyup(function(e) {
alert(e.which);
});
});
$(document).ready(function() {
$('#new-to-do-item').keyup(function(e) {
if (e.which === 13) {
var text = $(this).val();
alert(text);
}
});
});
$(document).ready(function() {
$('#new-to-do-item').keyup(function(e) {
if (e.which === 13) {
var text = $(this).val();
var listItem = "<li><input type='checkbox'>" + text + "</li>"
$('ul').append(listItem);
}
});
});
require 'open-uri'
print "Enter a website domain you like (without the http://): "
website = gets.chomp
begin
file = open("http://#{website}")
contents = file.read
unless contents.index("<h1>").nil?
header_start = contents.index("<h1>") + 4
p "Enter a number: "
num1 = gets.chomp.to_i
p "Enter an exponent: "
num2 = gets.chomp.to_i
def exponent(number, exp)
answer = number
if exp == 0
answer = 1
p "Enter a number: "
num1 = gets.chomp.to_i
p "Enter an exponent: "
num2 = gets.chomp.to_i
def exponent(number, exp)
number ** exp
end