Skip to content

Instantly share code, notes, and snippets.

View davidDuymelinck's full-sized avatar

davidDuymelinck

View GitHub Profile
@davidDuymelinck
davidDuymelinck / ghostery_hubspot_message.js
Last active June 6, 2018 09:22 — forked from adrianspeyer/ghostery_hubspot_message.js
How to handle Ghostery blocking your HubSpot forms. This appends a message asking user to add your site to whitelist. Just add it to the footer in any HubSpot COS page.
$(window).load(function () {
if($('.hs_cos_wrapper_type_form input[type="text"]').length === 0) {
var lang = $('html').attr('lang');
var msg = 'If you are seeing this message you may have Adblock or Ghostery enabled. Please consider enabling Hubspot forms.';
switch(lang) {
case 'nl':
case 'nl-be':
msg = 'Als je deze booschap ziet heb je waarschijnlijk Adblock of Ghostery. Gelieve Hubspot forms toe te laten.';
break;
@davidDuymelinck
davidDuymelinck / NewUserRegisterForm.php
Last active June 1, 2017 07:52
Extend drupal 8 user register form
<?php
namespace Drupal\my_module\Form;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Entity\EntityFormBuilderInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
<?php
$form = [
1 => [
'step_name' => 'step 1',
'sections' => [
[
'section_name' => 'section 1',
'fields' => [
'field_1' => [],
'field_2' => []
@davidDuymelinck
davidDuymelinck / DefaultController.php
Created March 26, 2016 15:42
POC dynamic form in symfony 3
<?php
namespace DppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Constraints\NotBlank;
@davidDuymelinck
davidDuymelinck / bcopen.js
Created May 22, 2015 01:15
barrio cantina open all descriptions
var links = document.getElementsByClassName('fttoggle'); for(var i = 0; i < links.length; i++){ links[i].click(); }
@davidDuymelinck
davidDuymelinck / mariana.js
Created May 16, 2015 09:51
Json to html for himalaya
var mariana = {
parse : function(json){
return mariana.checkFragment(json);
},
checkFragment : function(arr){
var out = '';
for(fragment of arr){
switch(fragment.kind){
case "element": out += mariana.element(fragment); break;
@davidDuymelinck
davidDuymelinck / index.php
Created March 27, 2015 05:45
quick and dirty php routing
<?php
$path = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $_SERVER['REQUEST_URI'];
if(strpos($path, '/search/book') !== false){ echo str_replace('/search/book/', '', $path); }
.quanty-query(@number, @comparison, @content) when (@comparison = 'greater'), (@comparison = 'more'), (@comparison = '>'){
&:nth-last-child(n @{number}):first-child {
&,
& ~ * {
@content();
}
}
}
.quanty-query(@number, @comparison, @content) when (@comparison = 'fewer'), (@comparison = 'less'), (@comparison = '<'){
&:nth-last-child(-n @{number}):first-child {
@davidDuymelinck
davidDuymelinck / ContactController.php
Last active September 26, 2015 10:45
Laravel 5 contact demo
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Http\Requests\ContactFormRequest;
use App\Events\ContactFormValid;
class ContactController extends Controller {
public function getIndex()
@davidDuymelinck
davidDuymelinck / index.html
Last active August 29, 2015 14:14
web component static website demo
<html>
<head>
<link rel="import" href="indexMain.html">
</head>
<body>
<section class="main"></section>
<script src="site.js"></script>
<script>
site.addTemplate('.main', 'indexMain.html');
</script>