Skip to content

Instantly share code, notes, and snippets.

@jadwigo
jadwigo / basic-form.html
Last active November 28, 2017 14:46
A selection of fields and markup that a real form might have.
<html>
<head>
<title>Form example</title>
<style>
body {
margin: 1em auto;
max-width: 60em;
}
form {
width: 60%;
@jadwigo
jadwigo / lookup-provincie.php
Created August 16, 2017 10:44
Lookup Nederlandse provincie ahv. cijfers van de postcode
<?php
/**
* Lookup provincie ahv postcode:
* https://nl.wikipedia.org/wiki/Postcodes_in_Nederland
*
* @param $postcode
*
* @return string
*/
function lookupProvincie($postcode) {
@jadwigo
jadwigo / test.php
Last active December 6, 2016 11:32
<?php
guesstimate_file_location($boltforms_location, $public_location) {
$tested = false;
$formfilename = $boltforms_location . '/testfile.txt';
$publicfilename = $public_location . '/testfile.txt';
$timestamp = microtime();
if(file_put_contents ( $formfilename , $timestamp )) {
@jadwigo
jadwigo / contenttypes.yml
Last active November 18, 2016 14:21
FAQ section in bolt
pages:
name: Pages
singular_name: Page
fields:
title:
type: text
class: large
group: content
slug:
type: slug
pages:
name: Pages
singular_name: Page
fields:
title:
type: text
class: large
group: content
slug:
type: slug
@jadwigo
jadwigo / mini.js
Last active July 11, 2016 16:06
datum voor FormatGoogleCalendar
// zet huidige maand aan
var todaydate = new Date();
var current_day = todaydate.getDate();
var current_year = todaydate.getFullYear();
var current_month = todaydate.getMonth();
if(current_month < 10) {
current_month = '0' + current_month;
}
// zet volgende maand aan
@jadwigo
jadwigo / toggle.js
Last active February 1, 2016 13:45
// FAQ
$('.faq .bodytext').hide(); // alle teksten sluiten
$('.faq h4.title').removeClass('open'); // alle "open" classes verwijderen
$('.faq h4.title').click(function() {
if($(this).hasClass('open')!=true) { // kijk of deze title al open is
$('.faq h4.title').removeClass('open'); // sluit alle open title
$('.faq .bodytext').slideUp('fast'); // sluit alle open teksten
$(this).parents('.faq').find('.bodytext').slideDown('fast'); // open deze tekst
$(this).addClass('open'); // voeg open class toe bij deze title
{% setcontent bgimgrecord = 'headerbeeld/random/1' %}
{% set bgimg = bgimgrecord.image|first %}
<div class="bgimg" style="background-image: url(/files/{{ bgimg.file }});"></div>
@jadwigo
jadwigo / boltformvalues.yml
Last active December 8, 2015 16:16
boltforms example fields
contact:
notification:
enabled: true
debug: false
subject: Your message was submitted
from_name: My Site
from_email: [email protected]
to_name: My Site # Must be valid text
to_email: [email protected] # Must be valid email address
attach_files: false
@jadwigo
jadwigo / konami-jquery.js
Created August 18, 2015 12:27
How to add a konamicode to your jqueries
// Konami code block
jQuery(function( $ ){
if ( window.addEventListener ) {
var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
window.addEventListener("keydown", function(e){
kkeys.push( e.keyCode );
if ( kkeys.toString().indexOf( konami ) >= 0 ) {
console.log('> Someone entered Konami Code. Quickly, do something cool!')
console.log('< Do something cool?');
console.log('> Yes!, Quickly!');