This file contains hidden or 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
package main | |
import "fmt" | |
type Rectangle struct { | |
length, width int | |
} | |
func (r *Rectangle) Area() int { | |
return r.length * r.width |
This file contains hidden or 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
hello world! |
This file contains hidden or 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
package main | |
import "fmt" | |
func main() { | |
fmt.Println("hello world!") | |
} |
This file contains hidden or 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
#!/usr/bin/env ruby | |
# Function to print strftime results | |
def print_strftime_formats(a, current_date) | |
a.each do |format| | |
b = "%#{format}" | |
output = current_date.strftime(b) | |
puts "t.strftime('#{b}'), => #{output}" | |
end | |
end |
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.define :cli do |cli| | |
cli.vm.box = "ubuntu/trusty64" | |
cli.vm.network :private_network, ip: "10.1.1.22" | |
cli.vm.hostname = "cli" | |
cli.vm.synced_folder "./", "/home/vagrant/app" | |
cli.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" |
This file contains hidden or 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
grill.food = Burger.new | |
grill.grilling # => "Grilling the burgers!" | |
grill.food = VeggiePatty.new | |
grill.grilling # => "Grilling the veggie patties!" |
This file contains hidden or 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
grill = Grill.new(Sandwich.new) | |
grill.grilling # => "Grilling the sandwich!" |
This file contains hidden or 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
class Grill | |
attr_accessor :food | |
def initialize(food) | |
@food = food | |
end | |
def grilling | |
"Grilling the #{food.type}!" | |
end |
This file contains hidden or 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
class Food | |
def type | |
raise NotImplementedError, 'Ask the subclass' | |
end | |
end | |
class Sandwich < Food | |
def type | |
'sandwich' | |
end |
This file contains hidden or 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
@mixin box-values($height, $width, $background, $margin, $padding) { | |
height: $height; | |
width: $width; | |
background: $background; | |
margin: $margin; | |
padding: $padding; | |
} | |
@mixin margin-padding($margin, $padding) { | |
display: inline; | |
margin: $margin; |
NewerOlder