Skip to content

Instantly share code, notes, and snippets.

View ankedsgn's full-sized avatar

Anke ankedsgn

  • Flink
View GitHub Profile
@ankedsgn
ankedsgn / contenttypes.yml
Created November 30, 2018 10:24
Check in contenttypes.yml met regex op valide URL
website:
type: text
label: Website sponsor
postfix: 'formaat: http://www.sponsor.nl'
pattern: "^http(s?):\/\/.*" # see: http://html5pattern.com/
error: "Vul een url in inclusief 'http://' of 'https://'"
@ankedsgn
ankedsgn / Using the function
Last active October 26, 2018 12:37
Set cookies with JS
setCookie('ppkcookie','testcookie',7);
var x = getCookie('ppkcookie');
if (x) {
[do something with x]
}
// source https://stackoverflow.com/questions/14573223/set-cookie-and-get-cookie-with-javascript
@ankedsgn
ankedsgn / boltforms.bolt.yml
Last active August 22, 2018 10:28
Maak een Honeypot dmv een hidden field in de boltforms config
custom:
type: hidden
options:
label: 'Custom'
required: false
attr:
class: hidden
constraints: [ Blank ]
Source: https://stackoverflow.com/questions/20541306/how-to-write-a-css-hack-for-ie-11
IE 6
============
* html .ie6 {property:value;}
or
.ie6 { _property:value;}
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-XXXXXXX', 'auto');
ga('set', 'forceSSL', true);
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
<script async="" src="https://www.google-analytics.com/analytics.js"></script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-X', 'auto');
@ankedsgn
ankedsgn / Google Tag manager with anonimyzed IP
Last active May 29, 2018 08:50
Google Tag manager with anonimyzed IP
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=XX-XXXX-XX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'XX-XXXXXX-XX', { 'anonymize_ip': true });
</script>
{# extra supernested lookup table #}
{% set personinfo = {
'1198' : {
'color' : '#ff0099',
'number' : '9',
'title' : 'My fingers are cold',
'portraitsrc' : 'portrait_piet.png',
'imgsrc' : 'image_piet.png'
},
/* sauce: https://www.paulirish.com/2009/random-hex-color-code-snippets/ */
<script>
bgcolor = '';
bgcolor = '#'+Math.floor(Math.random()*16777215).toString(16);
coverimg += 'background-color:' + bgcolor;
$('.background').removeAttr('style').attr('style', coverimg);
</script>
@ankedsgn
ankedsgn / Get raw menu from bolt settings
Last active May 7, 2018 12:50
Get raw menu from Bolt, no submenus, do something after halfway through loop
{% set footerthemamenu = app.config.get('menu/samen-verder') %}
<ul>
{% for item in footerthemamenu %}
{# Get record of the menu item, to create the real routes #}
{% setcontent itemrecord = item.path %}
<li>
<a href="{{ itemrecord.link }}">{{ item.label }}</a>
</li>