Skip to content

Instantly share code, notes, and snippets.

@cuth
cuth / serve.js
Created April 14, 2014 17:21
Run a local express server on the current directory's static files using node
var host = "127.0.0.1";
var port = 1337;
var express = require("express");
var app = express();
app.use('/', express.static(__dirname + '/'));
app.listen(port, host);
console.log('Running server at http://localhost:' + port + '/');
@cuth
cuth / debug-scroll.md
Last active October 18, 2024 08:22
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) {
@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 / 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 / express.bat
Created March 17, 2014 16:36
Batch file to run IIS Express on the current directory. Optionally set the first parameter to set the port number.
SET EX="C:\Program Files\IIS Express\iisexpress.exe"
if not "%1" == "" (
CALL %EX% /path:%CD% /port:%1
) else (
CALL %EX% /path:%CD%
)
@cuth
cuth / Highlightjs-Bookmarklet.md
Last active April 3, 2021 12:09
This is a simple bookmarklet to wrap code in a textarea with the correct highlight.js elements.

highlight.js bookmarklet

This is a bookmarklet to wrap code in a textarea with the appropriate highlight.js elements. Simply select the code in a text field then activate the bookmarklet. There will be a prompt to enter the language. This will only work on sites that have highlight.js installed.

(function (d) {
    var a = d.activeElement,
        t = a.value,
 s = a.selectionStart,
@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 / AMDwithManualUMD.md
Last active April 22, 2017 20:47
Mixing an AMD script loading solution with a traditional script loading solution with UMD modules causes a conflict.

Using RequireJS and loading UMD scripts normally

Mixing an AMD script loading solution with a traditional script loading solution with UMD modules causes a conflict.

Two approches to loading scripts

The traditional way to load a script is to manually add a script tag on the page like this:

@cuth
cuth / Hamburger.svg
Created May 7, 2014 20:43
Hamburger Menu Icon
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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'));