Skip to content

Instantly share code, notes, and snippets.

View MoritzGiessmann's full-sized avatar
👋

Moritz G. MoritzGiessmann

👋
View GitHub Profile
@MoritzGiessmann
MoritzGiessmann / gist:ee0b17c5c3c84773df7fdbc72e805822
Last active September 13, 2021 18:16
A firelit room helpers
// Stoke fire
setInterval(()=>{document.querySelector('#stokeButton').click()}, 1000);
// Gather wood
setInterval(()=>{document.querySelector('#gatherButton').click()}, 1000);
// Check traps
setInterval(()=>{document.querySelector('#trapsButton').click()}, 1000);
@MoritzGiessmann
MoritzGiessmann / nextcloud-deck-import-from-colornote-export-file.py
Created January 9, 2021 23:59
ColorNote Android to Nextcloud Deck import script
import requests
urlFrom = 'https://nextcloud.server.url'
authFrom = ('username', 'password')
headers={'OCS-APIRequest': 'true', 'Content-Type': 'application/json'}
boardId = 1 #integer
stackId = 1 #integer
def createCards(title):
@MoritzGiessmann
MoritzGiessmann / js
Created October 16, 2020 17:38
JavaScript to select a random HTML element on the MDN elements list https://developer.mozilla.org/en-US/docs/Web/HTML/Element
// Just put it into the js console
document.querySelectorAll('a > code')[Math.floor(Math.random() * Math.floor(100))].innerText
@MoritzGiessmann
MoritzGiessmann / gist:f7f01b1eb1de599c04d6922a49665ee8
Last active February 10, 2018 20:06
Hide Twitter Light "somebody likes that" and sponsored posts (German) Tampermonkery script
// ==UserScript==
// @name Twitter Light Debullcrappifier
// @namespace https://mobile.twitter.com/home
// @version 0.1
// @description Hide Twitter Light "somebody likes that" and sponsored posts (German) Tampermonkery script
// @author @MoritzGiessmann
// @match https://mobile.twitter.com/*
// @grant none
// ==/UserScript==
javascript:var s=document.createElement('script');s.setAttribute('src', 'https://github.com/Khan/tota11y/releases/download/0.0.3/tota11y.min.js');document.getElementsByTagName('body')[0].appendChild(s);void(s);
@MoritzGiessmann
MoritzGiessmann / gist:d35892d36c7ac658c7f5
Created September 19, 2014 10:57
Regex: find all attributes with specific name including their value
attribute-name="[^\"]+"

Conditional loading uncomment technique

Show content (in this example slides of a slideshow) only if there is enough horizontal space (e.g. 900px) for them by uncommenting the html. Why would you do this? Because you want to save traffic on mobile devices and make the site loading faster. And you maybe don't want to place image paths or other content in your javascript files.

A Pen by Moritz Gießmann on CodePen.

License.

@MoritzGiessmann
MoritzGiessmann / gist:8055285
Last active January 28, 2024 15:30
2QR bookmarkletChanges URL to http://2qr.org/url to show a qr code leading to the page you're visiting
/**
* 2QR bookmarklet
* -------------------------
* @function Changes URL to http://2qr.org/url to show a qr code leading to the page you're visiting (2qr.org is a service by YasonBy)
* @usage Copy the code and use it as a bookmark link
* @author https://moritzgiessmann.de
*
*/
javascript:(function(){window.location.href = 'http://2qr.org/' + window.location.href;})();