Skip to content

Instantly share code, notes, and snippets.

View ItsCosmas's full-sized avatar
🔨
Building

Cozy! ItsCosmas

🔨
Building
View GitHub Profile
# ASSERIONS
print(1)
assert 2 + 2 == 4
print(2)
assert 1 + 1 == 3
print(3)
# Assertions are often placed at the start of a function to check for valid input
# and at the end to check for valid output
def even_numbers(x):
for i in range(x):
if i % 2 == 0:
yield i
for i in even_numbers(100):
print(i)
# USEFUL for extending functionality of functions you don't wanna modify
# this function takes a function as its parameter
def decorator(function):
def wrap():
print("Adding Printing Functionality")
function()
print("Adding Print Functionality")
# FUNCTION ARGUMENTS
def function(named_arg, *args):
print(named_arg)
print(args)
function("arg1", "arg2", "arg3", "arg4")
# KEYWORD ARGUMENTS
def keyword_function(argument=1, **kwargs):
print(argument)
print(kwargs)
keyword_function(x=1, y=2, z=3)
@ItsCosmas
ItsCosmas / docker-help.md
Created June 21, 2019 10:26 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

// The Home Page
import React, { Component } from "react";
import "./Blog.scss";
import BlogCardCol from "./BlogCardCol";
import BlogCardRow from "./BlogCardRow";
class Blog extends Component {
render() {
@import '../../assets/scss/abstracts/variables';
@import '../../assets/scss/abstracts/mixins';
.blog {
padding: 4rem;
&__section {
padding: 2rem;
}
import React from "react";
import { Link } from "react-router-dom";
import hotpost from "../../assets/img/hot-post-1.jpg";
const BlogCardCol = () => {
return (
<div className='blog__card-column'>
<figure className='blog__card-fig'>
<Link to='/article' className='blog__card-link'>
import React from "react";
import { Link } from "react-router-dom";
import img_side from "../../assets/img/img.jpg";
const BlogCardRow = () => {
return (
<div className='blog__card-row'>
<figure className='blog__card-row__fig'>
<Link href='' className='blog__card-link'>