Skip to content

Instantly share code, notes, and snippets.

View billmei's full-sized avatar
☑️
Verified Profile

Bill Mei billmei

☑️
Verified Profile
View GitHub Profile
@billmei
billmei / alertModal.js
Created April 8, 2015 19:00
Display error messages to the user using a Bootstrap modal
function alertModal(title, body) {
// Display error message to the user in a modal
$('#alert-modal-title').html(title);
$('#alert-modal-body').html(body);
$('#alert-modal').modal('show');
}
@billmei
billmei / HTMLchecklist.md
Last active September 2, 2022 05:40
Checklist to have a W3C compliant, secure, SEO friendly, mobile-friendly, maximally-compatible HTML site.

Checklist for new websites

Once you're done coding your site, go through this checklist to make sure you have a W3C compliant, valid HTML, secure, maximally-compatible, optimal-performance, responsive and mobile-friendly, SEO-friendly website.

SEO

  • <title> is keyword friendly
  • <meta name="description" content="" />
  • ``
@billmei
billmei / timelapse.md
Last active January 14, 2022 10:54 — forked from Sybrand/timelapse.md
ffmpeg time-lapse

Convert sequence of GoPro Hero 6 Black JPEG images to MKV / MP4 video

ffmpeg \
  -r 30000/1001 \
  -pattern_type glob -i '*.JPG' \
  -vf "crop=in_w:in_w*9/16,scale=3840:-2" \
  -sws_flags lanczos \
  -pix_fmt yuv420p \
 -vcodec libx264 \
@billmei
billmei / countries.html
Last active November 19, 2021 17:33
Option select list of countries and country codes
<select>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
<option value="AG">Antigua and Barbuda</option>
@billmei
billmei / checklist.md
Created May 13, 2021 11:38
Car checklist

Exterior

  • Windshield free of cracks
  • Body panel colors match
  • Magnet adheres to all steel body panels
  • Fresh paint job (if yes, it could be to conceal rust)
  • Seams where the trunk and hood close are properly aligned
  • Seams where doors and fenders meet are properly aligned
  • Free of body scratches
  • Free of body dents
@billmei
billmei / index.html
Created April 6, 2015 17:16
Responsive Tables in pure CSS
<table>
<thead>
<tr>
<th>Payment</th>
<th>Issue Date</th>
<th>Amount</th>
<th>Period</th>
</tr>
</thead>
<tbody>
@billmei
billmei / strikethrough.js
Last active March 31, 2021 09:11
Adds unicode strikethrough characters to your input so that you can post it to comment boxes and social media websites (Facebook, Twitter, etc.) that don't accept HTML tags
const strikethroughText = text =>
text.split('').reduce((acc, char) =>
acc + char + '\u0335', '')
// strikethroughText("amazingly few discotheques provide jukeboxes")
// "a̵m̵a̵z̵i̵n̵g̵l̵y̵ ̵f̵e̵w̵ ̵d̵i̵s̵c̵o̵t̵h̵e̵q̵u̵e̵s̵ ̵p̵r̵o̵v̵i̵d̵e̵ ̵j̵u̵k̵e̵b̵o̵x̵e̵s̵"
@billmei
billmei / keepalive.js
Created January 14, 2021 16:17
Tampermonkey script to prevent Queen's MyCareer, Moodle, and D2L sessions from timing out.
// ==UserScript==
// @name KeepAlive
// @namespace https://billmei.net
// @version 0.1
// @description Prevents Queen's MyCareer, Moodle, and D2L from timing out
// @include https://careers.sso.queensu.ca/*
// @include https://moodle.queensu.ca/*
// @include https://qsblearning.ca/*
// @copyright 2014, Bill Mei
// ==/UserScript==
@billmei
billmei / edx_speed_options.js
Last active August 30, 2020 01:34
Add extra speed options like 2x playback on EdX videos.
// In the new EdX, a redirect is required to go inside the iframe before executing custom JavaScript
open(document.getElementById('unit-iframe').src)
// After the new tab is opened, you can run the code below in that tab (not the old tab).
// To use, paste into your DevTools console, create a bookmarklet, or use a browser extension like Tampermonkey.
const addSpeedOption = (speed) =>
$('.video-speeds').prepend(`<li data-speed="${speed}"><button class="control speed-option" tabindex="-1" aria-pressed="false">${speed}x</button></li>`)
addSpeedOption(2);
addSpeedOption(2.5);
@billmei
billmei / jQuery_inject.js
Created August 29, 2020 02:32
Inject jQuery into a page. Useful from the DevTools console if the site doesn't have jQuery. Avoids CSP issues.
// From https://stackoverflow.com/a/55885836/2142259
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"
document.getElementsByTagName('head')[0].appendChild(jq);