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
<html> | |
<head> | |
<title>jsonp test</title> | |
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
$('#select_link').click(function(e){ | |
e.preventDefault(); | |
console.log('select_link clicked'); | |
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 | |
/** | |
* Implements hook_preprocess_views_view_unformatted(). | |
*/ | |
function YOUR_THEME_preprocess_views_view_unformatted(&$variables) { | |
// Determine if this view's content should render in columns. | |
// @see: _YOUR_THEME_views_columns(); | |
_YOUR_THEME_views_columns($variables, array( | |
'articles|page' => 2, |
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 | |
/** | |
* UUID class | |
* | |
* The following class generates VALID RFC 4122 COMPLIANT | |
* Universally Unique IDentifiers (UUID) version 3, 4 and 5. | |
* | |
* UUIDs generated validates using OSSP UUID Tool, and output | |
* for named-based UUIDs are exactly the same. This is a pure | |
* PHP implementation. |
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 SetPerms($dir = ".") { | |
$listDir = array(); | |
if($handler = opendir($dir)) { | |
while (($sub = readdir($handler)) !== FALSE) { | |
if ($sub != "." && $sub != "..") { | |
if(is_file($dir."/".$sub)) { | |
echo "File: $dir/$sub\n"; | |
chmod($dir."/".$sub, 0644); |
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
cache_get() returns $cache objects even if the cached item is stale (expired) | |
function custom_fn_get_data() { | |
// Return the cached data | |
$cache = cache_get('custom:fn_get_data'); | |
if (!$cache) { | |
// Some expensive processing to build the data. | |
$data = complicated_recursion_and_loops_on_lots_of_data(); | |
// Cache the data and rebuild it every hour |
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
Location module has the function location_distance_between() (also in D7). | |
It passes the call on to function earth_distance($longitude1, $latitude1, $longitude2, $latitude2), which lives inside the earth.inc file in the same package. | |
See also: http://en.wikipedia.org/wiki/Great-circle_distance, which points out some of the intricacies of numerical calculation and accuracy of long vs short distances. |
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
{ | |
"vars": { | |
"@gray-base": "#000", | |
"@gray-darker": "lighten(@gray-base, 13.5%)", | |
"@gray-dark": "lighten(@gray-base, 20%)", | |
"@gray": "lighten(@gray-base, 33.5%)", | |
"@gray-light": "lighten(@gray-base, 46.7%)", | |
"@gray-lighter": "lighten(@gray-base, 93.5%)", | |
"@brand-primary": "darken(#428bca, 6.5%)", | |
"@brand-success": "#5cb85c", |
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
$(document).ready( function () { | |
$('body:last-child').bind('ajaxSuccess', function() { | |
init_ajax_sucess(); | |
}); | |
}); | |
function init_ajax_sucess() { | |
// Do something | |
} |
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
Array | |
( | |
[hook_menu] => 6744 | |
[hook_uninstall] => 4742 | |
[hook_perm(ission)] => 4012 | |
[hook_install] => 3751 | |
[hook_theme] => 3525 | |
[hook_schema] => 3003 | |
[hook_help] => 2465 | |
[hook_form_alter] => 2273 |
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
// emit to all sockets (aka publish) | |
// including yourself | |
io.sockets.emit('messageName', {thisIs: 'theMessage'}); | |
// broadcast to a room (aka publish) | |
// excluding yourself, if you're in it | |
socket.broadcast.to('roomName').emit('messageName', {thisIs: 'theMessage'}); | |
// emit to a room (aka publish) | |
// including yourself |
OlderNewer