This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Promise plugin aggregate(promiseMap). | |
* | |
* Creates a Promise that maps the incremental results of given promises in an Object with keys given by the input map. | |
* Errors if any of the given promises erros. | |
* | |
* Examples: | |
* | |
* Promise.aggregate({ | |
* cats: Promise.resolve(['Felix', 'Garfield']), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.toJSO = function () { | |
var obj = {}, | |
$kids = $(this).children('[name]'); | |
if (!$kids.length) { | |
return $(this).val(); | |
} | |
$kids.each(function () { | |
var $el = $(this), | |
name = $el.attr('name'); | |
if ($el.siblings("[name=" + name + "]").length) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toJSON(node){ | |
if(!$(node).children().length) return $(node).val(); | |
var json = new Object(); | |
$(node).children('[name]').each(function(){ | |
if($(this).siblings("[name="+$(this).attr('name')+"]").length){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function arrayToXML($array,$parent,$xml=null){ | |
$index = 0; | |
if($xml == null){ | |
$xml = new SimpleXMLElement("<".$parent."/>"); |