Skip to content

Instantly share code, notes, and snippets.

@cuth
cuth / Agent-Portal.md
Last active February 5, 2020 21:33
Notes on Agent Portal development

Quotes

  • CRU4Q-550288
  • CRU4Q-553017
  • BOP: CRU4Q-552171

Download in header

  • CRU4Q-550807

Commercial Product

  • NY HO3: 71A9B6049EF7425DABFB17BDC1A78DFA
@cuth
cuth / hyperterm-aliases.md
Last active November 8, 2021 07:08
Load websites, search Google or open local files; all within HyperTerm

HyperTerm aliases

HyperTerm is a terminal that is built with Electron. Electron is like building apps with a baked-in browser (Chromium). So what makes HyperTerm easily unique from other terminals is the ability to load websites right inside the terminal window.

To open a website in Hyperterm, just type the URL in the command line:

@cuth
cuth / example.js
Last active January 15, 2016 20:22
Disable AMD when requiring a file.
const safeRequire = require('./safe-require');
const umdStyleMod = safeRequire('umd-style-mod', () => require('umd-style-mod'));
@cuth
cuth / README.md
Last active May 20, 2022 22:06
Font Size Bookmarklet

Font Size Bookmarklet

Code

javascript:(function(){var getFontSize=function(el){return parseFloat(getComputedStyle(el,null)['font-size']);};document.addEventListener('wheel',function(e){if(!e.altKey)return;e.preventDefault();var el=e.target;var parent=el.parentElement;var size=getFontSize(el);while(parent&&size===getFontSize(parent)){el.style.fontSize='inherit';el=parent;parent=parent.parentElement;}if(e.wheelDelta>0){size+=1;}else{size-=1;}el.style.fontSize=size+'px';});}());
@cuth
cuth / lazy.js
Last active August 29, 2015 14:19
Run a function if a media query matches or once the media query eventually matches
var lazy = function (mediaQuery, load, unload) {
'use strict';
if (typeof mediaQuery !== 'string') return;
if (typeof load !== 'function') return;
var mql = matchMedia(mediaQuery);
var isLoaded = false;
if (mql.matches) {
@cuth
cuth / once.js
Created April 17, 2015 19:30
Run a function once
var once = function (fn) {
'use strict';
var ret;
var called = false;
return function () {
if (called) {
return ret;
}
@cuth
cuth / pre-commit
Last active August 29, 2015 14:05
Run JSHint before a git commit.
#!/bin/sh
#
# Run JSHint validation before commit.
files=$(git diff --cached --name-only --diff-filter=ACMR -- *.js **/*.js)
pass=true
if [ "$files" != "" ]; then
for file in ${files}; do
@cuth
cuth / LollapaloozaChecklist.md
Created August 5, 2014 20:51
A checklist of things you should bring to Lollapalooza.

Lollapalooza Checklist

  • Lolla bracelets
  • Sun glasses
  • Sunscreen
  • Rain poncho
  • Ziplock bags for phones
  • Hand sanitizer
  • Allergy medication
@cuth
cuth / Stash.md
Last active January 11, 2016 15:16
Cache any jQuery selector with $.stash

jquery.stash

Easily cache a jQuery selector to improve performance when reusing the same selector. Caching is only supported on strings and does not support the context argument.

Poor jQuery example:

$('.select li').html('test');
$('.select li').empty();
@cuth
cuth / debug-scroll.md
Last active February 7, 2024 18:17
Find the elements that are causing a horizontal scroll. Based on http://css-tricks.com/findingfixing-unintended-body-overflow/

Debug Horizontal Scroll

(function (d) {
    var w = d.documentElement.offsetWidth,
        t = d.createTreeWalker(d.body, NodeFilter.SHOW_ELEMENT),
        b;
    while (t.nextNode()) {
        b = t.currentNode.getBoundingClientRect();
 if (b.right > w || b.left < 0) {