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
# Doing some OOP (object oriented programming) where we can create our own objects and define them. I'll be using manga information as my example. | |
class Manga | |
attr_accessor :title, :mangaka, :genre | |
def about_manga | |
return "A good #{@genre} manga that I recommend for everyone to read is #{@mangaka}'s #{@title}." | |
end | |
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
# Doing some OOP (object oriented programming) where we can create our own objects and define them. I'll be using manga information as my example. | |
class Manga | |
def set_title=(title) | |
@title = title | |
end | |
def get_title | |
return @title | |
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
# This is an actual blog script, built by Ruby. Gotta use class variables, class methods, loops, make your own methods, make your own objects, etc. etc. etc. This ain't no WordPress, by the way. | |
class Blog | |
@@all_posts = [] | |
@@num_posts = 0 | |
def self.all | |
@@all_posts | |
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
# You are now at the Always 3 script. It's in Ruby, girl. Hello and welcome! | |
# Ask the person (user) to provide a number. Any number. | |
puts "Please, give me your number, I mean A number!" | |
# Hint: use 'gets' method, convert to an integer using 'to_i', make it a variable | |
i_number = gets.to_i | |
# Hmm... PEMDAS? ("Please Excuse My Dear Aunt Sally") | |
puts "You know what it is! " + (((i_number + 5) * 2 - 4) / 2 - i_number).to_s + " of course!" |
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
# You are now at the Always 3 script. It's in Ruby, girl. Hello and welcome! | |
# Ask the person (user) to provide a number. Any number. | |
puts "Please, give me your number, I mean A number!" | |
# Hint: use 'gets' method, convert to an integer using 'to_i', make it a variable | |
i_number = gets.to_i | |
# (Refactoring script) Need to refactor using only two variables. I took out the ii_number variable from the old version and left with i_number and fin_number. Maybe... | |
fin_number = i_number |
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
# Numerology app. I'm new to this, since I'm completely unfamiliar with Numerology in itself. Okay, here we go! Ganbarimasu! | |
# the person/user inputs his/her birthday in integer format | |
puts "Welcome to the Numerology App! Let's start off by giving me your birthdate. Please provide it in MMDDYYYY format. Thank you!" | |
# using gets to get their birthday to a variable | |
birthday = gets | |
# going to use .to_i to convert the inputs to integers in array format | |
number = birthday[0].to_i + birthday[1].to_i + birthday[2].to_i + birthday[3].to_i + birthday[4].to_i + birthday[5].to_i + birthday[6].to_i + birthday[7].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
# You are now at the Always 3 script. It's in Ruby, girl. Hello and welcome! | |
# Ask the person (user) to provide a number. Any number. | |
puts "Please, give me your number, I mean A number!" | |
# Hint: use 'gets' method, convert to an integer using 'to_i', make it a variable | |
i_number = gets.to_i | |
# add 5 | |
ii_number = i_number + 5 |
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
# TOML format | |
+++ | |
tags = ["x", "y"] | |
categories = ["x", "y"] | |
slug = "" | |
+++ | |
# YAML format | |
--- | |
tags = ["x", "y"] |
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
// JSON (Javascript Object Notation) format | |
{ | |
"title": "Welcome to my awesome site!", | |
"description": "An intro to CBLW powered by Hugo", | |
"tags": [ "Cardcaptor Sakura", "Sakura Kinomoto", "Syaoran Li", "Intro" ], | |
"date": "2016-06-16", | |
"categories": [ | |
"General", | |
"Random Stuff" |
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
# YAML (YAML Ain't Markup Language) format | |
--- | |
title: "Welcome to my awesome site!" | |
description: "An intro to CBLW powered by Hugo" | |
tags: [ "Cardcaptor Sakura", "Sakura Kinomoto", "Syaoran Li", "Intro" ] | |
date: "2016-06-16" | |
categories: | |
- "General" | |
- "Random Stuff" |