Skip to content

Instantly share code, notes, and snippets.

@thesamesam
thesamesam / xz-backdoor.md
Last active May 27, 2024 12:26
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that

This gist is a simple no-brainer description of the 3 ways (actually 2.5) the Web handle events.

<tag onclick />

The declarative inline HTML event listener is mostly an indirection of DOM Level 0 events, meaning this simply uses the equivalent of tag.onclick = listener behind the scene.

Example

click me
@marcamos
marcamos / handle-multiple-nav-menus-accessibly.js
Last active December 22, 2022 13:31
Simple, accessible, nav menu system that is keyboard friendly. Demo here: https://codepen.io/marcamos/pen/zYEXegV
const navButtonEl = '[aria-controls^="nav-menu-"]';
const navMenuEl = '[id^="nav-menu-"]';
const navButtons = Array.from(document.querySelectorAll(navButtonEl));
const navMenus = Array.from(document.querySelectorAll(navMenuEl));
const closeNavMenu = () => {
navButtons.forEach(button => {
button.setAttribute('aria-expanded', false);
});
navMenus.forEach(menu => {
menu.hidden = true;
@eliotharper
eliotharper / UpdateQuery.js
Created January 31, 2021 09:48
Updates SFMC Query Activity with Auto-Suppression list as target Data Extension
<script language="javascript" runat="server">
// Author: Eliot Harper <eliot@eliot.com.au>
// Revision date: January 31, 2021
// DISCLAIMER
// While due care has been taken in the preparation of this
// supplied code example, no liability is assumed for incidental
// or consequential damages in connection with or arising out its
// use. Example code is provided on an "as is" basis and no
// expressed or implied warranty of any kind is made for the
import { useEffect } from 'react';
import { get } from 'lodash';
import { navigate } from 'gatsby';
import { useLoading } from '@luigiclaudio/ga-baseline-ui/helpers';
import { Identity } from '@luigiclaudio/ga-auth-theme';
const useUser = () => {
const { user, getFreshJWT, logoutUser } = Identity.useIdentityContext();
const [isLoading, load] = useLoading();
const tokenObject = get(user, 'token');
@soerenmartius
soerenmartius / _src_modules_auth_store_index.ts
Last active June 29, 2023 02:28
Vue 3 with Typescriptt and Vuex 4 Typed Modules Examples ( with real types )
import {
ActionContext,
ActionTree,
GetterTree,
MutationTree,
Module,
Store as VuexStore,
CommitOptions,
DispatchOptions,
} from 'vuex'
@mohokh67
mohokh67 / timestamp-formatter.md
Created June 1, 2020 14:26
Get YYYY-MM-DD HH-MM-SS in JavaScript
const formatedTimestamp = ()=> {
  const d = new Date()
  const date = d.toISOString().split('T')[0];
  const time = d.toTimeString().split(' ')[0].replace(/:/g, '-');
  return `${date} ${time}`
}
@wvpv
wvpv / SFMC-AMPscript-exclusion-script-content-block.amp
Created February 27, 2020 22:11
Exclusion Script Content Block - Prevent duplicates
%%[
var @contextInsertDate
set @contextInsertDate = AttributeValue("YOUR_TSD_DE_INSERT_DATE")
set @contextInsertDate = format(@contextInsertDate,"yyyyMMddhhmmss")
var @exclude
set @exclude = 0
@marcamos
marcamos / lazy-load.js
Last active February 2, 2022 14:19
Lazy-loading polyfill; it covers the various ways you can use an <img> element, <picture> elements, and CSS background images … but it gets out of the way if the environment natively supports lazy-loading.
// Use #1: <img> element using src and srcset:
// <img data-lazy-srcset="/path/to/image-2x.jpg 2x"
// data-lazy-src="/path/to/image-1x.jpg"
// alt="TODO" width="TODO" height="TODO" loading="lazy" />
//
// Use #2: <img> element using src, srcset, and sizes:
// <img data-lazy-srcset="your srcset list here"
// data-lazy-src="/path/to/image.jpg"
// sizes="your sizes list here"
// alt="TODO" width="TODO" height="TODO" loading="lazy" />
@eddiewebb
eddiewebb / readme.md
Last active February 12, 2024 08:46
Hugo JS Searching with Fuse.js