Skip to content

Instantly share code, notes, and snippets.

View ryanlong1004's full-sized avatar
💭
Around here somewhere...

Ryan Long ryanlong1004

💭
Around here somewhere...
View GitHub Profile
@ryanlong1004
ryanlong1004 / provision.sh
Created October 13, 2020 17:08
Vagrant Provisioning for Centos
#!/usr/bin/env bash
### Update package repo
sudo yum update -y && sudo yum upgrade -y
### Install yum utils
# https://linux.die.net/man/1/yum-utils
sudo yum install yum utils -y
@ryanlong1004
ryanlong1004 / Vagrantfile
Created October 13, 2020 17:09
Default Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.define 'noaa-env-centos' do |config|
config.vm.hostname = 'noaa-env-centos.local'
config.vm.network "forwarded_port", guest: 8080, host: 8080, guest_ip: "127.0.0.1", auto_correct: true
config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ["dmode=777", "fmode=776"]
config.vm.provision "shell", path: "provision.sh"
end
end
@ryanlong1004
ryanlong1004 / MVCSG_overview.md
Created October 19, 2020 22:48
Model/View/Controller/Service/Gateway

Model / View / Controller / Service / Gateway

View

Views provide the UI/UX. Their responsibility is to take requests from the user to send to the associated controller, and display the response results of that request.

PHP code should be put into views only when necessary, as excessive amounts of PHP code mixed with HTML and JS add more cognitive load to the developer trying to work on the code.

 Tasks 
@ryanlong1004
ryanlong1004 / frozen_json.py
Created October 23, 2020 18:59
Frozen JSON in Python
import json
import keyword
import os
from collections import abc
from io import TextIOWrapper
class FrozenJSON:
"""Read only facade for navigating a JSON like object using attribute notation """
@ryanlong1004
ryanlong1004 / descriptors.py
Created October 23, 2020 19:01
Descriptor implementation in Python for validating different entities using the descriptor pattern.
import os
import re
from abc import ABC, abstractmethod
class AutoStorage:
"""Base for implementing descriptors """
__counter = 0
@ryanlong1004
ryanlong1004 / npm_install_without_sudo.txt
Created November 13, 2020 18:40
npm Install Without sudo
mkdir ~/.npm
npm config set prefix ~/.npm
nano ~/.bashrc
export PATH="$PATH:$HOME/.npm/bin"
source ~/.bashrc
@ryanlong1004
ryanlong1004 / .bashrc
Last active January 7, 2021 03:48
Config Files
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@ryanlong1004
ryanlong1004 / settings.json
Created January 6, 2021 04:52
Windows Terminal Settings
// This file was initially generated by Windows Terminal 1.3.2651.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "Ubuntu",
// You can add more global application settings here.
@ryanlong1004
ryanlong1004 / conftest.py
Last active January 6, 2021 06:38
Python3 Pytest fixtures
import os
import shutil
import time
from typing import Iterator, TypeVar
import pytest
from py._path.local import LocalPath
@pytest.fixture
@ryanlong1004
ryanlong1004 / log.py
Created January 6, 2021 06:34
Python3 logging snippet
import logging
def main():
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename="blitzcrank.log", encoding="utf-8", mode="w")
handler.setFormatter(
logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s")
)