Skip to content

Instantly share code, notes, and snippets.

package main
import "fmt"
type Rectangle struct {
length, width int
}
func (r *Rectangle) Area() int {
return r.length * r.width
hello world!
package main
import "fmt"
func main() {
fmt.Println("hello world!")
}
#!/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
# -*- 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'"
grill.food = Burger.new
grill.grilling # => "Grilling the burgers!"
grill.food = VeggiePatty.new
grill.grilling # => "Grilling the veggie patties!"
grill = Grill.new(Sandwich.new)
grill.grilling # => "Grilling the sandwich!"
class Grill
attr_accessor :food
def initialize(food)
@food = food
end
def grilling
"Grilling the #{food.type}!"
end
class Food
def type
raise NotImplementedError, 'Ask the subclass'
end
end
class Sandwich < Food
def type
'sandwich'
end
@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;