Skip to content

Instantly share code, notes, and snippets.

View JoeDoyle23's full-sized avatar
:shipit:
JavaScripting

Joe Doyle JoeDoyle23

:shipit:
JavaScripting
View GitHub Profile
@JoeDoyle23
JoeDoyle23 / rl.js
Created December 15, 2019 23:08
Readline
const {promisify} require('util');
const readline = require('readline');
const r = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const rl = promisify(r.question);
@JoeDoyle23
JoeDoyle23 / dynamicShim.js
Last active December 10, 2019 16:58
dynamic shim load with callback
function loadUserLeapAndRun(callback) {
if (!window.UserLeap) {
window.UserLeap = function(){U._queue.push(arguments)}
let U = window.UserLeap;U.appId = 'xxxxxxxxx';U._queue = [];
let a=document.createElement('script');
a.async=1;a.src='https://cdn.userleap.com/shim.js?id='+U.appId;
p=document.getElementsByTagName('script')[0];
p.parentNode.insertBefore(a, p);
}
}
1) Starting and navigating the terminal!
2) Terminology: event loop, callbacks, promises, etc
3) Or (||) operator
4) Comments in code
5) console.log formatting - console.log('Server running %s:%d...', host, port);

Keybase proof

I hereby claim:

  • I am JoeDoyle23 on github.
  • I am joedoyle23 (https://keybase.io/joedoyle23) on keybase.
  • I have a public key whose fingerprint is 81F0 64FD BEF4 DE10 FAB6 89E6 A051 33AE 95B3 7E61

To claim this, I am signing this object:

@JoeDoyle23
JoeDoyle23 / FileVersioner.ascx.cs
Created March 28, 2013 14:55
A WebForms user control to add a query string to prevent browser caching when the file changes. Works with JavaScript files (script tags) and CSS stylesheets (link tags).
/*
Usage:
For JavaScript Files
<asp:FileVersioner Path="~/js/plugins/jQuery-1.7.2.js" Type="script" runat="server"></asp:FileVersioner>
For CSS stylesheets
<asp:FileVersioner Path="~/stylesheets/CustomerPortal.css" Type="style" runat="server"></asp:FileVersioner>
*/
using System;