Skip to content

Instantly share code, notes, and snippets.

View portfolio.js
// Twitter API
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
// Google Map API
function initMap() {
var myLatLng = {lat: 52.4483653, lng: 4.8176345};
var map = new google.maps.Map(document.getElementById('map'), {
center: myLatLng,
zoom: 14
});
var marker = new google.maps.Marker({
View ropasc.rb
def rock_paper_scissors
choice = ["Rock", "Paper", "Scissors"]
p_win = 0
c_win = 0
draw = 0
round = 0
puts ""
puts "Welcome to Rock, Paper, Scissors!"
puts "Please enter your name:"
name = gets.chomp
View pet.rb
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
View pet.rb
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
View pet.rb
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
View index.html
<!DOCTYPE html>
<html lang="en">
<!-- Head of document -->
<head>
<!-- Meta tags -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Page title -->
<title>Sem van Lent</title>
View pet.rb
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
View cat.rb
class Cat
attr_reader :color, :breed
attr_accessor :name
# attr_writer :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
def feed(food)
View fav_foods.rb
def fav_foods
food_array = []
3.times do
puts "Name a favourite food."
food_array << gets.chomp
end
p food_array
puts "Your favourite foods are #{food_array.join(", ")}."
food_array.each do |food|
puts "I like #{food} too!"
You can’t perform that action at this time.