Skip to content

Instantly share code, notes, and snippets.

A Runtime ImportMap Example

While it's not possible to define a <script type="importmap"> within a module, it is possible to define it in a synchronous <script> tag, as long as it's before any module starts executing.

Example (works in Chrome / Edge)

<!DOCTYPE html>
<html lang="en">
<head>
  • Make sure you are aware of the problem/feature.
  • Don't be rude, be polite.
  • Give suggestions and make clear why do you think you suggestion is better than the current approach.
  • Don't point out just the bad things, tell about what do you think is great as well.
  • Make it part of your daily workflow. (use github notifications)
  • http://www.dein.fr/2015-02-18-maslows-pyramid-of-code-review.html

pyramid

@WebReflection
WebReflection / base64.js
Last active April 29, 2017 02:44
Quite possibly the smallest base 64 utility out there.
// base64.decode(base64.encode('💩'));
// Browsers
const base64 = {
encode: str => btoa(unescape(encodeURIComponent(str))),
decode: str => decodeURIComponent(escape(atob(str)))
};
/* ES3 compat version
var base64 = {
@bradfrost
bradfrost / gist:59096a855281c433adc1
Last active September 4, 2023 15:01
Why I'm Not A JavaScript Developer

Answering the Front-end developer JavaScript interview questions to the best of my ability.

  • Explain event delegation

Sometimes you need to delegate events to things.

  • Explain how this works in JavaScript

This references the object or "thing" defined elsewhere. It's like "hey, thing I defined elsewhere, I'm talkin' to you."

  • Explain how prototypal inheritance works.
@larsnystrom
larsnystrom / Start Hotspot.desktop
Created January 10, 2014 15:07
Desktop entry files for starting and stopping ap-hotspot, a script for setting upp wireless hotspots in Access Point Mode. Information about ap-hotspot can be found on http://www.webupd8.org/2013/06/how-to-set-up-wireless-hotspot-access.html Save these two files to your desktop and make them executable. If you'd like to run them from the dash yo…
[Desktop Entry]
Name=Start Hotspot
Comment=Start a wireless hotspot in Access Point Mode
Exec=gksudo /usr/bin/ap-hotspot start
Icon=/usr/share/icons/gnome/48x48/devices/network-wireless.png
Terminal=false
Type=Application
Categories=Network;
@DavyLandman
DavyLandman / ssh-ssl-in-one.js
Last active July 20, 2017 09:41
A recent nodejs trick, hide the ssh agent behind a https port. This means you can serve stuff via https, and almost always login into ssh (since the 443 port is hardly filtered/proxied).And if you have ssh, well all bets are off ;-)
var net = require('net');
net.createServer(httpsSshSwitch).listen(443);
// if the first byte is 22, it is a https handshake,
// so redirect it to the actual https server (running on port 8443)
// else redirect it to the ssh instance.
//
// some ssh clients wait for the server to send the first welcome message
// so if we have not seen any data for 2 seconds, assume it is a ssh connection
@simoneloru
simoneloru / full_content.xml
Last active December 28, 2015 21:49
Content with all attributes
<contenttype typecode="CNT" typedescr="Generic Content" viewpage="**NULL**" listmodel="**NULL**" defaultmodel="**NULL**">
<attributes>
<attribute name="Attach" attributetype="Attach" />
<attribute name="Boolean" attributetype="Boolean" />
<attribute name="CheckBox" attributetype="CheckBox" />
<attribute name="Composite" attributetype="Composite">
<attributes>
<attribute name="Attach" attributetype="Attach" />
<attribute name="Boolean" attributetype="Boolean" />
<attribute name="CheckBox" attributetype="CheckBox" />
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@cheeaun
cheeaun / feed-readers-comparison.md
Last active April 28, 2023 03:25
Feed Readers comparison

Feed Readers comparison

My comparison notes for web-based remotely-hosted Google Reader clones/replacements. Has to be at least 90% similar to Google Reader and not some Pinterest-like or Instapaper-like apps.

Here's a list of almost all Google Reader alternatives. And another one here.

In no particular order, here goes:

CommaFeed

['touchstart', 'touchmove', 'touchend'].each(function(type){
Element.NativeEvents[type] = 2;
});
Element.Events.swipe = {
onAdd: function(fn){
var startX, startY, active = false;
var touchStart = function(event){
active = true;