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
puts "How many Fibonacci numbers would you like?" | |
n = gets.to_i | |
puts "Awesome! I'll get started on that right away!" | |
def fibonacci(n) | |
array = [] | |
a,b = 0,1 | |
n.times do | |
array << a | |
a,b = b,a+b | |
end |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
#Prints out the name in a "sanitized" form of "First M. Last"; that is, first name, space, middle initial, period, space, last name. | |
#If there is no middle name, prints the letter X with no period following it. | |
#If there are multiple middle names, uses the initial of the first one. | |
my $name = "Melanie Aurelia Shebel"; |
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
#ruby 2.2.1p85 (2015-02-26 revision 49769) | |
#energies files must contain time on left column, energy on right, separated by space | |
#change paths on line 73 | |
energies = Dir.glob('*energies.txt') | |
energies = energies.pop | |
text = File.open(energies).read | |
text = text.to_s | |
array = text.split("\n") |
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
<?php | |
wp_reset_postdata(); | |
if(comments_open( ) || have_comments()) : ?> | |
<div class="comments-area"> | |
<?php if ( post_password_required() ) : ?> | |
<p><?php _e( 'This post is password protected. Enter the password to view any comments ', 'zeon' ); ?></p> | |
</div> | |
<?php | |
/* Stop the rest of comments.php from being processed, |
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
#Purdue North Central doesn't have waitlists, but you can get notified of seat availability with this app | |
require 'rubygems' | |
require 'open-uri' | |
require 'hpricot' | |
require 'twilio-ruby' | |
availability = 0 | |
puts "Enter the CRN for the PNC course you would like to track:" | |
crn = gets.chomp.to_s |
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
a = [60, -60] | |
# 4 refers to number of 60s or -60s in each element of array | |
a = a.repeated_permutation(6).to_a | |
puts "The array contains #{a.length} elements." | |
#creates output file called permute.txt | |
out_file = File.new("permute_out.txt", "w") | |
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
puts( ' <(^.^)> LITTLE KNOWN FACTS O\' MELANIE <(^.^)>') | |
puts | |
puts( 'To play, select the letter that corresponds with your answer | |
then press return') | |
answer = '' | |
while answer != 'c' | |
puts( '#1 Gym class sux. How would Melanie get out of running laps in Elem school?') | |
puts | |
puts( 'a. She got a doctors note') |
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
# Is it customary to start variable counts at one? (ie. noun1) or | |
# at zero (ie. noun and the second being noun1) or how else is this | |
# handled? | |
print( 'Enter an adjective: ' ) | |
adjective1 = gets.chomp() | |
print( 'Enter a verb ending in "ed": ') | |
verbEd = gets.chomp() | |
print( 'Enter a plural noun: ') | |
pluralNoun1 = gets.chomp() |
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
# Try to figure out if there is a way to chomp & convert to an integer on | |
# same line (lines 7 and 8) | |
# Try to figure out how to print failure message (lines 14-16 & 20-22) for | |
# both cases in which the user is incorrect without having it in the program | |
# twice. | |
randNumber = rand(10) | |
randNumber = randNumber + 1 | |
print( 'Guess my number! Enter a number (1-10): ') | |
userNumber = gets.chomp.to_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
words = ['rocks', 'giraffes', 'nilla', 'dinosaur'] | |
puts 'Need input! Input:' | |
input = gets.chomp | |
found = false | |
words.each do |i| | |
if input == i | |
found = true | |
end |
OlderNewer