Skip to content

Instantly share code, notes, and snippets.

View crittermike's full-sized avatar

Mike Crittenden crittermike

View GitHub Profile
/slfksdfsdf
@crittermike
crittermike / gist:306749
Last active August 9, 2016 20:34
Auto tab size in Gedit
if view.get_insert_spaces_instead_of_tabs():
tabsize = view.get_tab_width()
spaces = ""
for i in range(tabsize):
spaces += " "
after = after.replace("\t",spaces)
function getEbooks(l,s,p,pw) {
// l=loc
// s = subject
// p = prodID (optional)
// pw - use password
url = "ebooks.php?loc=" + l + "&subject=" + s + "&prod=" + p + "&pw=" + pw;
$("#results").empty().html('<img align = "right" src="http://galesupport.com/picts/loading_cengage.gif" alt="loading" />');
$("#results").load(url);
find ./ -type f -exec sed -i ’s/oldstring/newstring/’ {} \;
a:link[href^="http://"]:after,
a[href^="http://"]:visited:after,
a:link[href^="https://"]:after,
a[href^="https://"]:visited:after {
content: " (" attr(href) ") ";
font-size: 90%;
}
<?php
function THEMENAME_preprocess_node(&$vars, $hook) {
$vars['content'] = preg_replace('/<p>(?!<img)/','<p class="first">', $vars['body'], 1);
}
<?php
/**
* Implementation of hook_translated_menu_link_alter()
*/
function MODULENAME_menu_translated_menu_link_alter(&$item, $map) {
$num_unapproved = db_result(db_query("SELECT count(*) FROM {node} WHERE status = '0' AND type = 'NODETYPE'"));
if ($num_unapproved > 0 && $item['mlid'] == '2101') {
$item['localized_options']['attributes']['class'] = 'attention';
}
}
jQuery.fn.slowEach = function( interval, callback ) {
var array = this;
if( ! array.length ) return;
var i = 0;
next();
function next() {
if( callback.call( array[i], i, array[i] ) !== false )
if( ++i < array.length )
setTimeout( next, interval );
}
$('.image').slowEach(5000, function() {
//code here
});
<div class="post $post.feather{% if post.pinned %} pinned{% endif %}{%if post.aggregate %} ${ post.aggregate | lower }{% endif %}" id="post_$post.id">