Skip to content

Instantly share code, notes, and snippets.

@Dizolivemint
Dizolivemint / gist:263c07b701663d108a15c3fb475d43a1
Created October 14, 2016 01:31
A Moodle Simple Broken Link Checker for Greasemonkey
// ==UserScript==
// @name Moodle Broken File Check
// @namespace elearning.pacificcollege.edu
// @description Check for Broken Files
// @version 1
// @include http://elearning.pacificcollege.edu/course/*
// @grant none
// ==/UserScript==
var links = document.links;
@Dizolivemint
Dizolivemint / git_cheat-sheet.md
Created May 25, 2017 15:29 — forked from davfre/git_cheat-sheet.md
git commandline cheat-sheet
@Dizolivemint
Dizolivemint / snap-accordion.js
Last active February 20, 2019 19:49
Accordion menus for Moodle course shells (Snap DOM)
$(document).ready(function () {
/*
// ****** EDIT THIS SECTION ONLY *******
// ****** Change Section Number and Accordion Titles *******
// ****** Change Webinar Resource Titles added last *******
// ****** Everything on the page is auto categorized *******
*/
/* Section */
var section = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
@Dizolivemint
Dizolivemint / add_to_cart.user.js
Last active May 11, 2024 02:30 — forked from beporter/add_to_cart.user.js
Greasemonkey script to repeatedly refresh a given page, look for specific "Add to Cart" buttons, click them if present, and make a lot of noise on success.
// ==UserScript==
// @name Add Saved Items to Cart
// @namespace https://gist.github.com/beporter/ce76204bcba35d9edb66b395bb5e9305
// @version 0.5
// @description Repeatedly refresh a given "saved items" page (Amazon, Walmart, BestBuy), look for specific "Add to Cart" buttons, click them if present, and make a lot of noise on success.
// @author https://github.com/beporter
// @match https://www.amazon.com/gp/registry/wishlist/*
// @match https://www.amazon.com/hz/wishlist/ls/*
// @match https://www.bestbuy.com/cart
// @match https://www.bestbuy.com/site/customer/lists/manage/saveditems
@Dizolivemint
Dizolivemint / h5presize.js
Last active March 11, 2021 19:51
H5P Resize Event
/* Wait for DOM to load */
document.addEventListener('DOMContentLoaded', function() {
/* Add event listener to TOC links */
const buttons = document.querySelectorAll('.chapter-title');
buttons.forEach(function(button) {
button.addEventListener('click', function () {
// Need a timeout to wait for the active page getting the correct class
setTimeout(function() {
const iframes = document.querySelectorAll('iframe');
iframes.forEach(function(iframe) {
@Dizolivemint
Dizolivemint / wp_pw_savefix.js
Last active April 5, 2021 22:44
WordPress Password Save Fix
// We want our front-end scripts queued on the login pages only
add_action( 'login_enqueue_scripts', array( $this, 'add_scripts' ) );
/* Hide the username with CSS, instead of as a hidden form field. */
// Dumb-browser-friendly solution is to wrap field in hidden div
$( '#resetpassform input[id=\'user_login\']' ).wrap(
'<div style="display:none">')
// Browsers are more likely to recognise the user ID if it's a text field
$( '#resetpassform input[id=\'user_login\']' ).attr( 'type', 'text' )
// Just in case, make sure the textfield isn't editable by the user
$( '#resetpassform input[id=\'user_login\']' ).attr( 'readonly', true )
@Dizolivemint
Dizolivemint / docker.md
Last active November 17, 2021 23:52
Docker Commands

Docker

docker build . will run the Dockerfile to create an image
docker build . -t [Dockerhub-username]/[image-name]:[v1] build an image with a specific version
docker push [Dockerhub-username]/[image-name][v1] push to dockerhub
docker images will print all the available images
docker run {IMAGE_ID} will run a container with the image
docker run -d {IMAGE_ID} will run a container with the image in the background
docker ps will print all the running containers
docker kill {CONTAINER_ID} will terminate the container

@Dizolivemint
Dizolivemint / serverless-websocket.md
Last active December 29, 2021 19:18
Serverless Websocket Setup

Serverless Websocket Setup

Install Client

npm install wscat -g

Connect

wscat -c <websocket url>

Serverless YAML Lambda Handler

@Dizolivemint
Dizolivemint / react-component-patterns.md
Last active June 2, 2022 22:30
React Component Design Patterns

Layout Components

Deal with arranging other components on a page

Split Screen

import styled from 'styled-components'

const Container = styled.div`
  display: flex;
`