Skip to content

Instantly share code, notes, and snippets.

View ElfhirDev's full-sized avatar

ElfhirDev ElfhirDev

View GitHub Profile
@ElfhirDev
ElfhirDev / eZ XML - JSON
Last active December 18, 2015 13:39
How to delete things annoying in a "eZ Publish XML dataypes" for a JSON includes.
{
def $outputXML = $myObject.data_map.myBlocXML.content.output.output_text|explode('"')|implode('\\"')|explode("\n")|implode(' ')|trim()}
}
@ElfhirDev
ElfhirDev / include js in js
Created June 5, 2013 14:46
Include a js script in a js script
function include(src, attributes)
{
try {
attributes = attributes || {};
attributes.type = "text/javascript";
attributes.src = src;
var script = document.createElement("script");
for(aName in attributes)
script[aName] = attributes[aName];
@ElfhirDev
ElfhirDev / JavaScript Array better
Last active December 15, 2015 01:49
JavaScript Multidimension Array Ctor Since creating a two dimensions array in JavaScript is a pain - for me - thanks to Matthew Crumley on Stackoverflow - this constructor of Array matches my idea of multi dimension array ctor.
function createArray(length) {
var a = new Array(length || 0);
if (arguments.length > 1) {
var args = Array.prototype.slice.call(arguments, 1);
for (var i = 0; i < length; i++) {
a[i] = createArray.apply(this, args);
}
}