Skip to content

Instantly share code, notes, and snippets.

View OllyHodgson's full-sized avatar

Olly Hodgson OllyHodgson

View GitHub Profile
@OllyHodgson
OllyHodgson / jquery.offscreen.js
Created November 22, 2018 10:49
Simple jquery plugin to transition elements onto the page using CSS animations
// Custom selector to find if something is in the viewport
// Adapted from https://stackoverflow.com/a/8897628/13019
jQuery.expr.pseudos.offscreen = function (el) {
var rect = el.getBoundingClientRect();
return (
(rect.x + rect.width) < 0 || (rect.y + rect.height) < 0 || (rect.x > window.innerWidth || rect.y > window.innerHeight)
);
};
@OllyHodgson
OllyHodgson / _LoadFromLiquidContentAPI.cshtml
Last active November 27, 2018 15:26
Load data from the DNN Evoq Liquid Content API using the DNN Razor Host module. Razor gives you a bit more control and flexibility than the built-in visualizers.
@using System
@using System.Net
@using System.Text
@using Newtonsoft.Json
@using Newtonsoft.Json.Linq
@{
// The API URL and your API Key
string url = "https://dnnapi.com/content/api/ContentItems?contentTypeId=7f0d48be-a6bf-4f3c-9fdf-ba895727e818";
string apikey = "**** INSERT YOUR API KEY HERE ****";
@OllyHodgson
OllyHodgson / SP2010 ASP:Repeater-based navigation with current item selection.aspx
Last active March 8, 2019 18:40
SharePoint 2010 top level navigation code. Built with a nested ASP:Repeater control. Easier to style with Bootstrap or Flexbox than the ASP:Menu control. Includes highlighting of the current section.
<!-- top navigation publishing data source -->
<PublishingNavigation:PortalSiteMapDataSource
id="topSiteMap"
runat="server"
EnableViewState="false"
SiteMapProvider="GlobalNavigation"
StartFromCurrentNode="false"
StartingNodeOffset="0"
ShowStartingNode="true"
TrimNonCurrentTypes="Heading"/>
So you want to set up remix in cloud run huh? It's pretty simple but i'm going to assume you can figure out most of the GCP UI on your own.
Cloud Run:
Step 1: Create a new service and take note of the service ID
Step 2: Allow all traffic in the /triggers tab
Cloud Build:
Step 1: Set up a Cloud Build trigger on your repo
Step 2: Point the configuration to "cloud build configuration file" at the root of your project
Step 3: Add the following to the substitution variables (so you can keep it safe):
@OllyHodgson
OllyHodgson / Icon.js
Created July 31, 2020 22:48
React component to use the Bootstrap 5 Icons in sprite form
import React from "react";
import classnames from "classnames";
import Icons from "bootstrap-icons/bootstrap-icons.svg";
const Icon = ({
className,
iconName,
height = "1rem",
width = "1rem",
label,