Skip to content

Instantly share code, notes, and snippets.

View betweenbrain's full-sized avatar
🎯
Focusing

Matt Thomas betweenbrain

🎯
Focusing
View GitHub Profile
@betweenbrain
betweenbrain / gist:1782739
Created February 9, 2012 20:08
Bash readline example that includes default answer from http://stackoverflow.com/a/4480034/901680
#!/bin/bash
read -p "Enter IP address: " -e -i 192.168.0.4 IP
echo $IP
@betweenbrain
betweenbrain / gist:2033316
Created March 14, 2012 01:51
jQuery toggle with hashtag detection
$(document).ready(function() {
$('dt').prepend('<img class="toggle" src="images/arrow.png" width="9" height="9" /> ');
var hashTag = window.location.hash.substring(1);
$('dd').each(function(i) {
var itemAnchor = $(this).prev('dt').find('a[name]').attr("name");
if ( itemAnchor == hashTag ) {
$(this).show();
}
else {
$(this).hide();
@betweenbrain
betweenbrain / gist:2644421
Created May 9, 2012 13:17
Add heading to absolute first article of first page of Joomla 2.5 category blog
Add the following to your /com_content/category/blog.php template override just before <?php $this->item = &$item; echo $this->loadTemplate('item'); ?> of the class="leading" item.
<?php if ($this->pagination->get('pages.current') == 1) echo '<h1>Absolute First Article</h1>' ?>
body {
font-size: 76%;
}
#body-container {
width: 96%;
}
#body-container .gutter {
margin: 0 2%;
}
@betweenbrain
betweenbrain / gist:2652806
Created May 10, 2012 12:39
Example Joomla template head
<?php defined('_JEXEC') or die;
$doc = JFactory::getDocument();
$doc->addStyleSheet('/templates/system/css/screen.css');
$doc->addStyleSheet('/templates/system/css/general.css');
$doc->addStyleSheet('templates/' . $this->template . '/css/default.css');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
@betweenbrain
betweenbrain / gist:2655257
Created May 10, 2012 19:20
DOCman 1.6.4 DOClink tweak to increase modal size
Index: components/com_docman/assets/css/doclink.css
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/com_docman/assets/css/doclink.css (revision 2a61a685c476f7a9c5780fa1aad1fae07892c1e5)
+++ components/com_docman/assets/css/doclink.css (revision )
@@ -9,7 +9,7 @@
*/
@betweenbrain
betweenbrain / gist:2769430
Created May 22, 2012 14:32
Various Regexes
Replace <li>(<span>.+?</span>) (<a .+?</a>)</li> with: <li>$2 $1</li> - https://twitter.com/#!/NoNumber_nl/status/204938777389576194
@betweenbrain
betweenbrain / gist:2829644
Created May 29, 2012 17:31
Google Lightbox Background
background: #666;
background-image: -webkit-gradient(radial,center center,125,center center,800,from(white),to(#4C4C4C));
background-image: -moz-radial-gradient(50% 50% 90deg,circle farthest-side,white,#4C4C4C);
position: fixed;
left: 0;
top: 0;
z-index: 999;
@betweenbrain
betweenbrain / gist:2895041
Created June 8, 2012 11:16
JHtml sliders - start in collapsed state
from: https://groups.google.com/forum/#!msg/joomla-dev-general/WfMoTdxf6hg/Mgep5T42i0EJ
<?php echo JHtml::_('sliders.start', 'slider-panel-id', array('useCookie'=>0, 'startOffset'=>-1, 'startTransition'=>1)); ?>
@betweenbrain
betweenbrain / gist:3012422
Created June 28, 2012 16:43
SQL to Update HTML in a Joomla article
update jos_content set introtext = replace(introtext,'<table style=\"width: 800px; height: 304px;\" border=\"0\">','<table border=\"0\">');