Skip to content

Instantly share code, notes, and snippets.

// 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({
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
"hello"
@Spesm
Spesm / pet.rb
Created December 14, 2018 10:14
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
@Spesm
Spesm / pet.rb
Created December 14, 2018 10:08
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
@Spesm
Spesm / pet.rb
Created December 14, 2018 10:01
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
<!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>
@Spesm
Spesm / pet.rb
Created December 13, 2018 21:05
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
@Spesm
Spesm / cat.rb
Created December 11, 2018 22:30
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)
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!"