Skip to content

Instantly share code, notes, and snippets.

View adieuadieu's full-sized avatar
🤷‍♂️

Marco Lüthy adieuadieu

🤷‍♂️
View GitHub Profile
@adieuadieu
adieuadieu / interpolator.js
Last active August 29, 2015 14:15
fancy pancy DOM interpolator (test)
var glob = require('glob')
, fs = require('fs')
, cheerio = require('cheerio')
, _ = require('lodash')
, contentful = require('contentful')
, htmlFilePath = './page.html'
, htmlFile = fs.readFileSync(htmlFilePath);
;
FormHelper = {
getFormData: function(event, allowEmpty) {
var allowEmpty = 'boolean' === typeof allowEmpty ? allowEmpty : true;
var form = event.target ? $(event.target) : event;
var data = {};
form.find('input[type="hidden"][name], input[type="text"][name], input[name]:checked, textarea[name], select[name]').each(function(i) {
var keys = $(this).attr('name').replace(/\]/g, '').split('[');
var marker;
for (var i = 0; i < keys.length; i++) {
addressbook_autocomplete: function() {
if ($('input[data-bind="addressbook-autocomplete"]').length > 0) {
$('input[data-bind="addressbook-autocomplete"]').autocomplete('destroy');
$('input[data-bind="addressbook-autocomplete"]').show();
function aao_handle_select(that, label, address) {
var div = document.createElement('div');
$('div[data-handle-for="' + $(that).attr('name') + '"]').remove();
var data = {}
, fields = [
'earth[africa][sudan][lion]'
, 'earth[africa][sudan][girafe]'
, 'earth[africa][sudan][monkeys][lemur]'
, 'earth[africa][zimbabwee][elephants]'
, 'earth[africa][zimbabwee][elephants]'
, 'earth[africa][zimbabwee][elephants]'
, 'earth[europe][switzerland][chocolate]'
, 'pluto[isnt][a][planet]'