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
# frozen_string_literal: true | |
module Foo | |
# Simple presenter module | |
# | |
# Uses Charlatan to create an `Foo::Presenter` module for use in the app. | |
# This isn't *strictly* a presenter - it's somewhere between a presenter, | |
# proxy, and/or decorator. | |
# | |
# Including `Foo::Presenter.new(:presented_thing)` in a class will |
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
require "concord" | |
require "procto" | |
# Small wrapper module for domain services. | |
# | |
# Creates a service object with a ::call method that delegates to the instance | |
# method name given in the `call` option. Defaults to :call. (Procto) | |
# | |
# Provides initializer arguments, sets the ivars, and optional public reader | |
# methods for the attribute names passed in for `attrs`. (Concord) |
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
object Example { | |
def main(args: Array[String]): Unit = { | |
println("Scala!") | |
// create some values to use | |
// TERM: assignment | |
val a = 1 | |
val b = 2 | |
val c = 3 |
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
importPackage(java.io); | |
importPackage(java.lang); | |
System.out.println("JavaScript!"); | |
// create some variables to use | |
// TERM: assignment | |
var a = 1; | |
var b = 2; | |
var c = 3; |
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
# 1. Create a class named Country | |
# 2. Add read/write support for the following attributes: | |
# :id | |
# :name | |
# :population | |
# :capital | |
# 3. Create an instance of your Country class |
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
# 1. Create a class named Country | |
# 2. Add the ability to read and write an attribute named "name". This should | |
# be done using two methods. | |
# HINT: the writer method has the `=` at the end | |
# HINT HINT: use an ivar to store the name in the scope of the class | |
# 3. Create an instance of your Country class | |
# 4. Set the name attribute |
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
def function(a) | |
a = a.to_i | |
if a == 1 | |
a + 5 / 2 | |
elsif a == 2 | |
a + 5 + 3 | |
elsif a > 2 && a <= 1000 | |
a | |
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
[ | |
{ | |
"id": "AGO", | |
"name": "Angola", | |
"population": 21471618, | |
"capital": "Luanda", | |
"latitude": -8.81155, | |
"longitude": 13.242, | |
"income_level": "Upper Middle", | |
"high_income": false |
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
# our list of countries created using a "literal" array and hashes. | |
countries = [ | |
{ | |
"id" => "AGO", | |
"name" => "Angola", | |
"population" => 21_471_618, | |
"capital" => "Luanda", | |
"latitude" => -8.81155, | |
"longitude" => 13.242, | |
"income_level" => "Upper Middle", |
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
# Angola | |
country0_id = "AGO" | |
country0_name = "Angola" | |
country0_population = 21_471_618 | |
country0_capital = "Luanda" | |
country0_latitude = -8.81155 | |
country0_longitude = 13.242 | |
country0_income_level = "Upper Middle" | |
country0_high_income = false |
NewerOlder