Skip to content

Instantly share code, notes, and snippets.

Project: Ruby Fundamentals CLI

Overview:

You'll create an interactive Ruby console application that allows users to explore the basics of the Ruby object model, manipulate different data types, and apply the concepts learned from the Honeybadger blog post on the Ruby object model. This console app will accept user input and perform actions based on that input, such as creating objects, manipulating strings and arrays, and performing calculations.

Part 1: Setting Up and Exploring Objects

Read the Honeybadger blog post on the Ruby object model to understand the basics of objects, classes, and modules in Ruby. Set up a new Ruby script file (explorer.rb). Write a simple ObjectExplorer class that will interact with the user through the command line. For now, it should greet the user and accept input.

@marlomajor
marlomajor / Homework_5
Created December 2, 2021 15:53
VolcanoCoin.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract VolcanoCoin is ERC20("Volcano Coin", "VOL"), Ownable{
constructor() {
_mint(msg.sender, initialSupply);
@marlomajor
marlomajor / VolcanoCoin.sol
Created November 15, 2021 05:05
Encode Homework_4
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;
contract VolcanoCoin {
uint public totalSupply = 10000;
address owner;
mapping(address => uint) public balances;
error Unauthorized();
constructor() {
@marlomajor
marlomajor / VolcanoCoin.sol
Last active November 11, 2021 06:27
Homework_3
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7; // Homework said ^0.8.0, but he also said choose latest available to us, so going with ^0.8.7
contract VolcanoCoin {
// initialize owner in constructor
constructor() { owner=msg.sender; }
// set variables for totalSupply and ownerAddress
uint totalSupply = 10000;
address owner;
0x7c263f45E8F33e726b2884992Aeff473F2A5AAFc
@marlomajor
marlomajor / recursion.markdown
Last active April 15, 2016 15:53 — forked from rrgayhart/recursion.markdown
Recursion and Generators Homework
  • Watch Recursion
  • Fork this gist
  • Answer the following questions in your fork
    • Do you pronounce 'babel' in the same way?
    • Bobble is CLASSIC.
      • Follow Up Question: Will you now? YASSSSSS
    • What is an example of why/where you might use recursion
  • Hmm...one place to use recursion would be...in a game loop where the games function has to be continually rerun. In Tyler and Jill's snake game, they had multiple instances of recursion in order to add to the snakes body and get the overall function of the game.

Step One: Watch Mary Rose Cook Live Codes Space Invaders from Front-Trends. (The second worst conference name ever?)

Step Two: Fork this gist.

Step Three: Respond to this question in your fork: What is one approach you can take from this Mary's code and implement in your project? She codes like a storyteller. This approach is something that resonates with me because I think in stories, if you will, and being able to design an entire game step by step simple by telling the story is something I hope to incorporate into my code design from now on. Honestly, without this video, it would've been much harder for me to complete my Gametime project, which was also Space Invaders. This video was very helpful in my implementation.

Step Four: Totally Optional: take a look at some of the other forks and comment if the spirit moves you.

Step One: Watch Writing Testable JavaScript - Rebecca Murphey from Full Frontal 2012 (award for worst conference name ever?)

Step Two: Fork this gist.

Step Three: Consider the four responsibilities that Rebecca lists for client side code (hint: they're color coded).

  • Did any of the responsibilities that she lists surprise you?
  • Presentation/Interaction, and Setup are obvious to me, but data server communication and application state are things I normally just don't think about. Those were definitely surprising to me. Now...to incorporate this aha moment into my code...
  • Do you feel like you mentally split your client side code in IdeaBox and other past projects into these responsibilities?
  • Only after building the entire application in one module was I able to extract the responsibilities and split the code into their respective responsibilities. For me, this was an easier way to understand the beginning of JavaScript.
@marlomajor
marlomajor / require.markdown
Last active April 15, 2016 15:52 — forked from rrgayhart/require.markdown
The Concept of Require

When you start working with WebPack for GameTime, you'll notice that you can't just define a variable in one file and find it in another as easily as you can in Rails.

Read Node.js, Require and Exports and Organize Your Code with RequireJS

Fork this gist and answer the following questions:

  • In the context of Node, what is a module? -- A module is a part of an application that has a specific purpose. You can write an entire application in one module, or you can break a small application into many modules for better organization and readability.
**Step One**: Watch [Sorting Algorithms in JavaScript](https://www.youtube.com/watch?v=uRyqlhjXYQI)
**Step Two**: Fork this gist.
**Step Three**: Respond to this question in your fork: "What are some of the balances and trade offs between different sorting algoritms?"
The question of which sorting algorithm should be used versus another depends on the goal of the project one is trying to solve. Our main concern with sorting algorithms are with how long it takes to complete the algorithm and also how much memory the algorithm uses. Bubble sort is a simple sorting algorithm, often used for teaching first lessons on algorithms. It's easy to understand as a visual, simple to pseudocode for a beginner, but slow in actual processing and low on the memory usage. So just in this one case alone, the positives for bubble sort are that it's simple to learn and uses little memory, but also requires a lot of time to run. Depending on the goal, the balances and trade offs one makes on sorting algorithms is dependent on