Skip to content

Instantly share code, notes, and snippets.

View GitSquared's full-sized avatar
👨‍🎤

Gabriel Saillard GitSquared

👨‍🎤
View GitHub Profile
@GitSquared
GitSquared / receiver-demo.html
Last active September 20, 2023 16:55
Use your browser to access a remote terminal.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Remote terminal</title>
<link rel="stylesheet" href="xterm.css" />
<script src="terminal.class.js"></script>
@GitSquared
GitSquared / form-keyboard-submit-jquery.js
Last active July 20, 2017 14:41
Automatically run the onsubmit="" function of forms when the enter key is pressed on the last input field.
$(() => {
let update_form_listeners = () => {
// Always check that the onsubmit attribute ends by return false; otherwise the page will reload
$("form[onsubmit] input:last-of-type").each((index, element) => {
if ($(element).parents('form').attr('onsubmit').substr(-13) !== 'return false;') {
$(element).parents('form').attr('onsubmit', $(element).parents('form').attr('onsubmit')+'return false;');
}
});
$("form[onsubmit] input:last-of-type").keypress((e) => {
@GitSquared
GitSquared / import.html
Last active January 22, 2021 14:35
Simple HTML Import with custom element that replaces itself with imported content
<script>
window.customElements.define('get-import', class extends HTMLElement {
constructor() {
super();
if (this.hasAttribute('url'))
window.fetch(this.attributes.url.value)
.then(res => res.text())
.then(txt => this.outerHTML = txt);
}
});
@GitSquared
GitSquared / index.html
Created February 26, 2017 18:12
Render de dégats pour jeux HTML5
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Déganimation</title>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
window.cursorPos = {x: 0, y: 0};