Skip to content

Instantly share code, notes, and snippets.

View adriculous's full-sized avatar
💕
Stay safe everyone!

Adrianne Padua adriculous

💕
Stay safe everyone!
View GitHub Profile
@adriculous
adriculous / manga2.rb
Created July 28, 2016 08:06
Attribute Accessors
# 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
@adriculous
adriculous / manga.rb
Created July 28, 2016 08:00
Ver. 1 of the object oriented sample code
# 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
@adriculous
adriculous / blog.rb
Last active July 27, 2016 16:31
(Hella) simple blog script built in Ruby
# 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
# 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!"
@adriculous
adriculous / always_three.rb
Last active July 21, 2016 06:25
"Always Three" Refactoring Challenge #1
# 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
@adriculous
adriculous / numerology.rb
Created July 19, 2016 22:30
Numerology App
# 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
@adriculous
adriculous / always_three.rb
Created July 19, 2016 01:13
"Always Three" First Ruby Script (courtesy of Skillcrush)
# 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
@adriculous
adriculous / gist:fbab5e1ea34ad03ce3634e3536217be2
Last active June 18, 2016 08:35
Archetype default.md front matter sample
# TOML format
+++
tags = ["x", "y"]
categories = ["x", "y"]
slug = ""
+++
# YAML format
---
tags = ["x", "y"]
// 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"
# 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"