Skip to content

Instantly share code, notes, and snippets.


Dave Hulbert dave1010

View GitHub Profile
View x
name: "search-php",
homepage: "",
author: { name: "David Hulbert", email: ""},
icon: "",
license: "MPL",
takes: {"function": noun_arb_text},
description: "Searches PHP for a function.",
View x
match beginnings of function names
say if no functions found
if > 1 function result, have a list of them
option to show more details of function?
get it working with and all languages it supports
name: "search-php",
View jQuery.twtShrt.js
* Make a form field shorten text as you type
* Made for keeping tweets < 140 chrs
* Usage: $('textarea').twtShrt();
* @author dave1010
jQuery.fn.twtShrt = function() {
var o = [
"seriously","have to", "what is", "done", "oh my god", "oh my gosh", "face to face", "for the win", "for the loss", "in real life", "your mileage may vary", "best regards", "joint venture", "let me know", "not safe for work", "are you ok", "tomorrow", "as soon as possible", "be right back", "be back later", "be back soon", "at the moment", "by the way", "in my honest opinion", "tata for now", "as known as", "also known as", "see you later", "see you", "for your information", "in my opinion", "too good to be true", "best friends forever", "best friend forever", "best friends", "best friend", "definitely", "been", "hello", "i am", "night", "when", "some", "to", "speak", "you", "your", "for", "friend", "people", "see", "be", "and", "&", "anyone", "because", "are", "bate", "date", "fate", "great", "hate", "late", "mate",
dave1010 / strip_word_html.php
Created Nov 12, 2010
Strip MS Word HTML. From
View strip_word_html.php
function strip_word_html($text, $allowed_tags = '<b><i><sup><sub><em><strong><u><br>')
//replace MS special characters first
$search = array('/&lsquo;/u', '/&rsquo;/u', '/&ldquo;/u', '/&rdquo;/u', '/&mdash;/u');
$replace = array('\'', '\'', '"', '"', '-');
$text = preg_replace($search, $replace, $text);
//make sure _all_ html entities are converted to the plain ascii equivalents - it appears
//in some MS headers, some html entities are encoded and some aren't
dave1010 / github-issue-quick-export.js
Created Nov 16, 2010
Get a quick list of all issues on the current page with their #
View github-issue-quick-export.js
// add as a bookmark with "javascript:" at the beginning of the URL to make into a bookmarklet
(function(){var o = '';$('.issue').each(function() {var n = '#' + $('.number', this).text().replace('.', '') + ' - ',t = $('.issue_title', this).text();o += n+t + '\n';});alert(o);})();
dave1010 /
Created Nov 30, 2010
# use ubuntu's notification system to let us know when there's something new in the apache error log
tail -n0 -f /var/log/apache2/error.log | while read line
body=`echo $line | cut -f 9- -d ' '`
notify-send -c im.received -i error "Apache / PHP error" "$body"
dave1010 / github-issues-total-hours.js
Created Dec 7, 2010
Name GitHub issues with hours like [2] in the title and this will add them up
We couldn’t find that file to show.
dave1010 / jquery.detach-select-options.js
Created Dec 12, 2010
jQuery plugin to detach (hide) select options and add them again.
View jquery.detach-select-options.js
// this is because of
$.fn.extend({detachOptions: function(o) {
var s = this;
return s.each(function(){
var d ='selectOptions') || [];
s.find(o).each(function() {
dave1010 /
Created Dec 21, 2010
grep time tests.xml | grep testcase | awk "{ print \$7 \$2 }"|sed 's/name="/ /g'|sed 's/time="//g'|sed 's/"\/>//g'|sed 's/"//g'|sort
dave1010 / (.sh
Created Mar 7, 2011 - for Peter's broken keyboard.
View (.sh
echo '('