Skip to content

Instantly share code, notes, and snippets.

View roz0n's full-sized avatar
🏁

Arnold Rozon roz0n

🏁
View GitHub Profile
@roz0n
roz0n / fullscreen.js
Created July 3, 2017 02:41
JavaScript Fullscreen API
// Find the right method, call on correct element
function launchFullscreen(element) {
if(element.requestFullscreen) {
element.requestFullscreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} else if(element.msRequestFullscreen) {
element.msRequestFullscreen();
@roz0n
roz0n / express-server-side-rendering.md
Created October 30, 2017 00:04 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@roz0n
roz0n / bs-table-collapse.html
Last active November 16, 2017 20:11
Bootstrap 4a Accordion (Collapse) Table
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Published</th>
<th>Comment Date</th>
</tr>
</thead>
@roz0n
roz0n / coinbase-timezones.html
Created May 21, 2019 22:44 — forked from alfonmga/coinbase-timezones.html
Coinbase.com TZ list
<select name="user[time_zone]" id="user_time_zone">
<option value="American Samoa">(GMT-11:00) American Samoa</option>
<option value="International Date Line West">(GMT-11:00) International Date Line West</option>
<option value="Midway Island">(GMT-11:00) Midway Island</option>
<option value="Hawaii">(GMT-10:00) Hawaii</option>
<option value="Alaska">(GMT-09:00) Alaska</option>
<option value="Pacific Time (US &amp; Canada)">(GMT-08:00) Pacific Time (US &amp; Canada)</option>
<option value="Tijuana">(GMT-08:00) Tijuana</option>
<option value="Arizona">(GMT-07:00) Arizona</option>
<option value="Chihuahua">(GMT-07:00) Chihuahua</option>
@roz0n
roz0n / terraform-general-tips.md
Created February 1, 2021 20:39
# Terraform General Tips/Tricks

Terraform General Tips/Tricks

Installing on MacOS with Homebrew

# tap it
brew tap hashicorp/tap
# install it
brew install hashicorp/tap/terraform
# upgrade it
@roz0n
roz0n / iac-terraform-ec2.md
Created February 1, 2021 20:40
IAC with Terraform

IAC with Terraform

What and Why

  • Terraform is a tool used for building, changing, and versioning infrastructure safely and efficiently
    • It supports many service providers, likewise one could roll their own custom or in-house solutions
    • IAC is defined using high-level languages HCL and good ol' JSON
      • We'll start with HCL later on as it's more commonly used for these purposes
  • Sysadmins used to purchase hardware, set up servers with network and software, and also maintain/modify them manually
    • Repetitive and time consuming
  • By definition, IAC is the process of managing and provisioning infrastructure through code instead of physical hardware configuration and interactive configuration tools
@roz0n
roz0n / iac-docker-node-ecr.md
Created February 1, 2021 20:40
Containerizing a Node App & Creating an Image Repo on ECR

Containerizing a Node App & Creating an Image Repo on ECR

What and Why

This document assumes you already have Docker installed and likewise are familiar with its use-cases. In essence, Docker is used to package our applications as standardized executable components (containers) that combine application source code with all the operating system libraries and dependencies required to run the code in any (typically cloud) environment(s).

There are many benefits to this, and there are likewise many caveats. Refer to Google to learn more.

Creating node-test

You should already know how to create a simple Node app with a single endpoint, but if you don't...

@roz0n
roz0n / guap-country-currency-data.js
Last active February 13, 2021 02:04
Combine ExchangeRate API currency codes, ISO codes, and full country names
// ExchangeRate API Supported Currencies
const currencies = {
"AED": {
"FIELD2": "UAE Dirham",
"FIELD3": "United Arab Emirates"
},
"AFN": {
"FIELD2": "Afghan Afghani",
"FIELD3": "Afghanistan"
},
@roz0n
roz0n / programmatic-ui.swift
Created February 21, 2021 18:59
iOS SceneDelegate Programmatic UI Setup
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let scene = (scene as? UIWindowScene) else { return }
let vc = ViewController()
let nc = UINavigationController(rootViewController: vc)
window = UIWindow(frame: scene.coordinateSpace.bounds)
window?.windowScene = scene
window?.rootViewController = nc
window?.makeKeyAndVisible()
@roz0n
roz0n / detached-vc-solution.swift
Created February 22, 2021 06:13
Presenting from detached view controllers in Swift
// UIViewController extension to get root VC
func getRootViewController(of nestedViewController: UIViewController) -> UIViewController? {
return nestedViewController.view.window?.rootViewController
}
// In use inside non-root VC
let vc = UINavigationController(rootViewController: CurrencySelectorViewController(type: type))
vc.modalPresentationStyle = .overFullScreen
if let root = getRootViewController(of: self) {