Skip to content

Instantly share code, notes, and snippets.

View joelpittet's full-sized avatar

Joel Pittet joelpittet

View GitHub Profile
@joelpittet
joelpittet / gist:770360
Created January 8, 2011 00:17
RaphaelJS - IE Bug with jQuery
<!DOCTYPE html>
<html>
<head>
<title>RaphaelJS - IE Bug with jQuery</title>
<!--
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="http://github.com/DmitryBaranovskiy/raphael/raw/master/raphael-min.js" type="text/javascript"></script>
-->
@joelpittet
joelpittet / gist:1220293
Created September 15, 2011 19:54
Dropdown menu that animates
var lastOpenItem = null;
$(".nav li.HasSubMenu ul").each(function(i, el){
$(this).data('originalHeight', $(this).height());
$(this).css('width', $(this).width());
})
$(".nav li.HasSubMenu ul").css({height: '0px'});
$(".nav li.HasSubMenu").hover(
function () {
$(this).addClass("hover");
$(this).children('ul').eq(0)
@joelpittet
joelpittet / gist:1926243
Created February 27, 2012 18:54
Distance as the bird flies
<?php
function distance($lat1, $lon1, $lat2, $lon2) {
$theta = $lon1 - $lon2;
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
$dist = acos($dist);
$dist = rad2deg($dist); // distance in nautical miles
//$miles = $dist * 60 * 1.1515;
$km = $dist * 60 * 1.852;
return $km;
@joelpittet
joelpittet / gist:3936591
Created October 23, 2012 04:11
Cookie minus salt
--- Cookie.php
+++ (clipboard)
@@ -39,6 +39,11 @@
* @var boolean Only transmit cookies over HTTP, disabling Javascript access
*/
public static $httponly = FALSE;
+
+ /**
+ * @var boolean Only turned off if the cookies need to be salted
+ */
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 909cde7..3b345d6 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -4285,26 +4285,28 @@ function template_preprocess_system_settings_form(&$variables) {
* A string containing an HTML-formatted form.
*
* @ingroup themeable
+ * @todo function to be removed later.
*/
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 4c37512..e5651d4 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -4290,7 +4290,7 @@ function theme_exposed_filters($variables) {
$form = $variables['form'];
$output = '';
- if (is_array($form) && isset($form['current']) {
+ if (is_array($form) && isset($form['current'])) {
diff --git a/core/themes/stark/templates/form.inc/form-element.html.twig b/core/themes/stark/templates/form.inc/form-element.html.twig
index 77d2851..a2241ab 100644
--- a/core/themes/stark/templates/form.inc/form-element.html.twig
+++ b/core/themes/stark/templates/form.inc/form-element.html.twig
@@ -59,7 +59,7 @@
{% endif %}
{% if description %}
- <div class="description {{ description.attributes.class }}" {{- description.attributes }}>{{ description }}</div>
+ <div class="description {{- description.attributes.class }}" {{- description.attributes }}>{{ description.text }}</div>
diff --git a/core/includes/form.inc b/core/includes/form.inc
index 85d1474..35e175b 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -5221,12 +5221,7 @@ function template_preprocess_form_element(&$variables) {
$variables['children'] = $element['#children'];
if (isset($element['#description'])) {
- $attributes = array();
- if (!empty($element['#id'])) {
<?php print t('View %name, displaying items of type <strong>@base</strong>.',
array('%name' => $view->get('name'), '@base' => $base_table)); ?>
{{ 'View %name, displaying items of type <strong>@base</strong>.'|t({'%name': view.get('name'), '@base': base_table}) }}
<?php
// Reference http://kohanaframework.org/3.3/guide-api/Kohana_View
// https://github.com/kohana/core/blob/3.3/master/classes/Kohana/View.php
// Instanciate a View and set and bind some variables to it
$table_view = View::factory('views-table.html.twig')
->set('title', 'My Table Title');
->bind('content', $content);
// Set content here because it's & referenced