Skip to content

Instantly share code, notes, and snippets.

View bballentine's full-sized avatar

Brandon Ballentine bballentine

View GitHub Profile
@bballentine
bballentine / Help-Widget.html
Created July 9, 2013 13:10
D2L Replace Strings Example - Help Widget
<!-- Create a new custom widget and place the following code in the Content area -->
<h2>Need help? Having trouble?</h2>
<ul>
<li><a href="/Shared/documentation/help.html?role={rolename}" target="_blank">Online Help</a></li>
<li><a href="#">Quick Reference Guides</a></li>
<li>Call the HelpDesk (865.694.6537) or <a href="#">email them</a></li>
</ul>
@bballentine
bballentine / Quiz-Footer.html
Created July 9, 2013 13:11
D2L Replace Strings Example - Quiz Footer
@bballentine
bballentine / Middleware
Created April 26, 2017 18:06
Vapor - Example middleware that checks user's role before giving access to protected resources.
import Vapor
import HTTP
public class AdminAuthMiddleware: Middleware {
public let error: Error
public let authLevel: UserRole
public init(error: Error, authLevel: UserRole) {
self.error = error
self.authLevel = authLevel
}
<html
xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"/>
<system-page-meta-keywords/>
<system-page-meta-description/>
<meta content="Pellissippi State Webmaster" name="author"/>
<title>Pellissippi State Community College</title>
@bballentine
bballentine / PSCC Accordian FAQ Sample
Created July 14, 2017 16:29
Reference code for creating new FAQ content in Cascade using the standard page template.
<div aria-multiselectable="true" id="accordion" role="tablist">
<div class="card">
<div class="card-header" id="heading-1" role="tab">
<h3 class="mb-0"><a aria-controls="collapse-1" aria-expanded="true" data-parent="#accordion" data-toggle="collapse" href="#collapse-1"> What is my P Number?
</a></h3>
</div>
<div aria-labelledby="heading-1" class="collapse show" id="collapse-1" role="tabpanel">
<div class="card-block">
<p>This is where the actual text goes</p>
</div>
@bballentine
bballentine / DeviceRotationViewModifier.swift
Created August 26, 2024 16:04
SwiftUI Device Rotation View Modifier
import SwiftUI
struct DeviceRotationViewModifier: ViewModifier {
let action: (UIDeviceOrientation) -> Void
func body(content: Content) -> some View {
content
.onReceive(NotificationCenter.default.publisher(for: UIDevice.orientationDidChangeNotification)) { _ in
action(UIDevice.current.orientation)
}