Skip to content

Instantly share code, notes, and snippets.

@edjw
edjw / demo-data.json
Last active July 23, 2024 12:30
ym-reactive-grid
{
"constituencies": [
{
"id": 1,
"name": "Aberafan Maesteg",
"messages": [
{
"sender": "John Doe",
"content": "Message content 1"
},
@edjw
edjw / tasks.json
Last active June 12, 2024 20:21
Autostart Vite in VSCode
// // .vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Run Vite",
"type": "shell",
"command": "pnpm run dev",
"presentation": {
"reveal": "silent",
@edjw
edjw / main.js
Last active April 18, 2024 14:57
Laracasts Theatre Mode
// Laracasts Theatre Mode: Add YouTube style tap 'T' for toggle theatre mode
// https://github.com/uzairfarooq/arrive
// prettier-ignore
const Arrive = function (e, t, n) { "use strict"; function r(e, t, n) { l.addMethod(t, n, e.unbindEvent), l.addMethod(t, n, e.unbindEventWithSelectorOrCallback), l.addMethod(t, n, e.unbindEventWithSelectorAndCallback) } function i(e) { e.arrive = f.bindEvent, r(f, e, "unbindArrive"), e.leave = d.bindEvent, r(d, e, "unbindLeave") } if (e.MutationObserver && "undefined" != typeof HTMLElement) { var o = 0, l = function () { var t = HTMLElement.prototype.matches || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector; return { matchesSelector: function (e, n) { return e instanceof HTMLElement && t.call(e, n) }, addMethod: function (e, t, r) { var i = e[t]; e[t] = function () { return r.length == arguments.length ? r.apply(this, arguments) : "function" == typeof i ? i.apply(this, arguments) : n } }, ca
@edjw
edjw / css-naked-day.js
Created April 8, 2024 13:12
CSS Naked Day JS
const styleElements = document.querySelectorAll(
'link[rel="stylesheet"], style'
);
const inlineStyleElements = document.querySelectorAll("[style]");
for (const styleElement of styleElements) {
if (styleElement.parentNode) {
styleElement.parentNode.removeChild(styleElement);
}
}
@edjw
edjw / stmungos-doors.html
Last active November 28, 2023 20:20
stmungos-doors
<style type="text/css">
section#main::before {
background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),
url("https://action.mungos.org/sites/stmungos/files/styles/full/public/christmas-background.jpg");
background-repeat: no-repeat;
background-size: cover;
content: "";
position: fixed; /* Fix position to cover whole area */
top: 0;
left: 0;
@edjw
edjw / fundraising-box-medeor-2023
Last active December 1, 2023 15:28
fundraising-box-medeor-nov-2023
// Also this in on-page CSS
// @keyframes fadeIn {
// 0% {opacity: 0;}
// 100% {opacity: 1;}
// }
// .fade-in {
// animation: fadeIn 1s;
// }
@edjw
edjw / ist-html-gist.html
Last active August 25, 2023 10:59
ist-html-gist
<p>hello from github html gist saved in gistpad</p>
@edjw
edjw / ist-js-gist.js
Last active August 25, 2023 10:35
ist-js-gist
console.log("hello from a github gist");
const title = document.querySelector(`h1#page-title`);
// Function to get the current time in HH:MM:SS format
function getCurrentTime() {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
return `${hours}:${minutes}:${seconds}`;
@edjw
edjw / ist-css-gist.css
Last active August 25, 2023 10:36
ist-css-gist
body {
background-color: salmon;
}
@edjw
edjw / load-github-gists.html
Last active August 29, 2023 13:25
load-github-gists
<script>
/**
* A script to fetch and apply JS and CSS from GitHub gists and GitLab snippets.
* Use with the Gistpad extension in VS Code for easy updating:
* https://marketplace.visualstudio.com/items?itemName=vsls-contrib.gistfs
*
* Note: For GitLab, it's likely the content fetch will fail due to CORS restrictions.
* With GitHub, rate limiting can be strict unless the gist is public.
*
* For html gists, specify the target using the html selector of an element on your page.