This file contains 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 | |
/** | |
* Extremely paranoid escaping function for use with inline JS strings. | |
* | |
* Escapes every single character to a \x# format. | |
* | |
* @param string | |
* | |
* @return string |
This file contains 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
javascript:(function(){var t=document.querySelector('meta[name="generator"], meta[name="Generator"]');alert(t?t.getAttribute("content"):"No generator meta tag found.")})(); |
This file contains 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
var foo = { | |
init: function(i, el) { | |
this.wrapper = el; | |
this.baseMarkerRadius = 2.5; // Base size of a cluster. | |
this.markerRadiusExpand = 1.5; // Added radius based on cluster size (e.g. 4 in a cluster, radius = 2.5 + 4 * 1.5) | |
this.clusterDistance = 10; // Distance in pixels for clustering. | |
this.offset = 268435456; // Half the circumference of the earth at zoom level 21 and in pixels. | |
this.radius = this.offset / Math.PI; // Used for clustering logic. | |
var that = this; // Scope us a reference. | |
var width = 940, |
This file contains 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
/** | |
* Wraps every num elements with el. | |
* | |
* Usage: $('.foo').wrapEach('<div></div>', 5); | |
* Wraps every 5 .foo's with a <div>, defaults to 2. | |
*/ | |
$.fn.wrapEach = function(el, num) { | |
num = num || 2; | |
for (var i = 0; i < this.length; i += num) { | |
this.slice(i, i + num).wrapAll(el); |
This file contains 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 somemodule_ds_fields_info($entity_type) { | |
$fields = array(); | |
$fields['node']['some_field'] = array( | |
// Arbitrary UI label. | |
'title' => t('Some field'), | |
// DS constant for field type function. | |
'field_type' => DS_FIELD_TYPE_FUNCTION, | |
// Name of the actual function. |
This file contains 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
var nicer_obj = function (obj) { | |
var new_obj = {} | |
for (key in obj) { | |
if (obj.hasOwnProperty(key)) { | |
try { new_obj[key] = obj[key]; } catch (err) {} | |
} | |
} | |
return new_obj; | |
} |
This file contains 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 findDeepest (elem) { | |
var result = {maxDepth: 0, deepestElem: null} | |
descend(elem, 0, result); | |
if (result.maxDepth > 0) | |
console.log(result); | |
} | |
function descend(elem, depth, result) { | |
switch (elem.nodeType) { |
This file contains 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
//Open your browser's console tab (F12 and click the console tab) and paste it there. Refresh the page to unload the script. | |
;(function(){ | |
API.on(API.ADVANCE,callback).trigger(API.ADVANCE); | |
function callback(){ | |
$('#woot').click(); | |
} | |
})(); | |
// Bookmark: javascript:(function(c){c=function(){$('#woot').click();};API.on(API.ADVANCE,c).trigger(API.ADVANCE);}()); |
This file contains 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
/*! | |
* | |
* stagas - mind swift (seutje techwobbles mix) | |
* | |
*/ | |
var bpm = 130; | |
var tuning = 440; | |
var transpose = 11; | |
var hardcodedTimer = 7.4; |
This file contains 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
/*! | |
* | |
* stagas - mind swift (seutje triphop mix) | |
* | |
*/ | |
var bpm = 130; | |
var tuning = 440; | |
var transpose = 11; |