Skip to content

Instantly share code, notes, and snippets.

View walshification's full-sized avatar

Christopher Walsh walshification

View GitHub Profile
from unittest.mock import Mock
thing = Mock()
thing
thing.any()
thing.foo
#!/usr/bin/env python
"""Let's audit Data Studio resources and permissions!"""
import logging
import os.path
import sys
from dataclasses import dataclass
from pathlib import Path
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'example_gem/version'
Gem::Specification.new do |spec|
spec.name = "example_gem"
spec.version = ExampleGem::VERSION
spec.authors = ["your_name"]
spec.email = ["your_email@email.com"]
@walshification
walshification / Screencast 20, Getters
Created September 24, 2014 13:12
Creating a Person class and constructor with getters
# Getters
class Person
attr_reader :name, :age, :occupation, :mood
def initialize
@name = "Jeffrey"
@age = 18
@occupation = "janitor"
@walshification
walshification / Screencast 19, Person Constructor
Created September 24, 2014 13:10
Creating a Person class with a class constructor
# Person Constructor
class Person
def initialize
@name = "Jeffrey"
@age = 18
@occupation = "janitor"
@mood = "testy"
end
@walshification
walshification / Screencast 19, Person Constructor
Created September 24, 2014 13:07
Creating a Person class with a class constructor
# Person Constructor
class Person
def initialize
@name = "Jeffrey"
@age = 18
@occupation = "janitor"
@mood = "testy"
end
@walshification
walshification / Screencast 18, Person
Created September 24, 2014 13:06
Creating a Person class that utilizes instance variables
# Person
class Person
def call(name)
@name = name
end
def measure(years)
@age = years
end
@walshification
walshification / Screencast 17, Calculator
Created September 24, 2014 13:03
Creating a Calculator class with mathematical methods
# Calculator
class Calculator
def double(number)
number * 2
end
def add(number1, number2)
number1 + number2
@walshification
walshification / Screencast 16, New Car
Created September 24, 2014 13:01
Creating a Car class with methods
# New car and the return value
class Car
def new_car
[]
end
def steering
"wheels"
@walshification
walshification / Screencast 15, Creating Methods
Created September 24, 2014 13:00
Creating different classes with custom methods
class Ninja
def speak
puts "From the shadows, I strike."
end
def vanish
puts "poof"
end