Skip to content

Instantly share code, notes, and snippets.

View bangpound's full-sized avatar

Benjamin Doherty bangpound

View GitHub Profile
// One way converter from E4X XML to JSON
// 1) turns <body><item>1</item><item>2</item></body> into
// body: {item: ["1", "2"]} so that lists are easier to work with
// 2) turns things like: <body a="a">whatever</body> into
// body: {_a: "a", _: "whatever"}
// however <body>whatever</body> becomes simply body: "whatever
// - attributes specified by ignored are ignored
function E4XtoJSON(xml, ignored) {
var r, children = xml.*, attributes = xml.@*, length = children.length();
if(length == 0) {
function nlirh_imagefield_widget($element) {
if ($element['#field_name'] == 'field_soy_poderosa_photo' && $element['#type_name'] == 'soy_poderosa_photo') {
print "WTF!";
$element['data']['title']['#title'] = t('The better title just for this field on this node type.');
}
drupal_add_css(drupal_get_path('module', 'imagefield') .'/imagefield.css');
$element['#id'] .= '-upload'; // Link the label to the upload field.
return theme('form_element', $element, $element['#children']);
}
@bangpound
bangpound / README.md
Created January 17, 2012 14:48 — forked from anonymous/README.md
Timed sopa/pipa strike blackout: Same as the sopablackout.org script, but only if today's 2012-18-1

The sopastrike.com script rocks, but you have to get up early on Wednesday and add it to all your sites, so what kind of strike is it if you have to work hard on that day? :)

Just add

<script type="text/javascript" src="//pastebin.com/raw.php?i=bip80DLx"></script>

somewhere between your <head> and </head>, and sleep late on Wednesday.

If you're using wordpress, do that at