Skip to content

Instantly share code, notes, and snippets.

View martinsvoboda's full-sized avatar

Martin Svoboda martinsvoboda

  • Prague, Czech Republic
View GitHub Profile
@martinsvoboda
martinsvoboda / gist:ea7fcfa30683c1220a6370b6867bbefe
Last active December 8, 2020 15:01
Superlazy Sentry integration
<script>
/* Dynamically load Sentry only when error is reported */
/* Similar to https://docs.sentry.io/platforms/javascript/install/lazy-load-sentry/ */
function log_to_sentry(e, url, line, column, error) {
if (!window.Sentry) {
var script = document.createElement('script');
script.src = "https://browser.sentry-cdn.com/5.29.0/bundle.min.js";
script.integrity="sha384-/dYT/04VSU9ItKRPTkWeVZ0kqRsVh/T/5rNCjzBwpx7sYeeueKgJzGMNXSal3xoo";
script.crossOrigin = "anonymous";
@martinsvoboda
martinsvoboda / index.html
Last active November 12, 2020 15:26
Lazyloading of Adsense ads
<ins class="adsbygoogle-lazy"
style="display:block"
data-ad-client="..."
data-ad-slot="..."
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<html>
<body>
<style>
.icon {
width: 1.5em;
height: 1.5em;
stroke: currentColor;
stroke-width: 1.5;
@martinsvoboda
martinsvoboda / nospaces.py
Last active April 9, 2020 09:21
Django template custom tag nospace - Removes whitespace inside tags and text
import re
from django.utils.encoding import force_text
from django.template import Library, Node
register = Library()
def strip_spaces_in_tags(value):