Skip to content

Instantly share code, notes, and snippets.

View dcgithub's full-sized avatar
💭
for those about to rock!..

dcgithub

💭
for those about to rock!..
  • None
  • Brisbane
View GitHub Profile
(function($) {
////
//
// Depends on the amazing Ajax form plugin.
//
// Callback receives responseText and 'success' / 'error'
// based on response.
//
// i.e.:
// $('#someform').spamjax(function(text, status) {
@isidorosp
isidorosp / thesaurus.js
Created October 4, 2008 22:57
thesaurus.js - a ubiquity command for finding synonyms
function findSynonyms(word, callback) {
var url = "http://services.aonaware.com/DictService/DictService.asmx/DefineInDict";
var params = Utils.paramsToString({
dictId: "moby-thes", //moby-thes: Moby Thesaurus II
word: word
});
Utils.ajaxGet(url + params, function(xml) {
CmdUtils.loadJQuery( function(jQuery) {
var text = jQuery(xml).find("WordDefinition").text();
$('a[href=#][alt^=""]').livequery('hover', function() {
window.status = $(this).attr('alt')
}, function() {
window.status = ''
})
Don't worry about what anybody else is going to do. The best way to
predict the future is to invent it.
-- Alan Kay
Premature optimization is the root of all evil (or at least most of it)
in programming.
-- Donald Knuth
Lisp has jokingly been called "the most intelligent way to misuse a
computer". I think that description is a great compliment because it
@jbevain
jbevain / MethodBaseRocks.cs
Created April 29, 2009 19:37
A reflection based disassembler
//
// MethodBaseRocks.cs
//
// Author:
// Jb Evain (jbevain@novell.com)
//
// WARNING: code now lives in http://github.com/jbevain/mono.reflection
//
// (C) 2009 Novell, Inc. (http://www.novell.com)
//
@jbevain
jbevain / BackingFieldResolver.cs
Created April 29, 2009 19:42
Code to resolve a property's backing field.
//
// BackingFieldResolver.cs
//
// Author:
// Jb Evain (jbevain@novell.com)
//
// WARNING: code now lives in http://github.com/jbevain/mono.reflection
//
// (C) 2009 Novell, Inc. (http://www.novell.com)
//
//
// adosql.js
//
if (typeof AdoDbUtil == 'undefined')
var AdoDbUtil = { };
AdoDbUtil.PROVIDER_MICROSOFT_JET_OLEDB_4_0 = 'Microsoft.Jet.OLEDB.4.0';
AdoDbUtil.PROVIDER_MSDASQL_1 = 'MSDASQL.1';
// http://msdn.microsoft.com/en-us/library/ms711711(VS.85).aspx
/*
* a smart poller for jquery.
* (by github)
*
* simple example:
*
* $.smartPoller(function(retry) {
* $.getJSON(url, function(data) {
* if (data) {
* doSomething(data)
(function(jQuery){
// This shortTermMemory will contain the last parsed simple selector.
// To be usefull it needs to be accessed faster than it would take to re-parse the selector.
// Selectors are to complex to serve as keys of a hash, and a bi-dimensional array would be too slow.
// I'm wondering if .data() would be fast enough for that purpose.
var shortTermMemory = [];
jQuery.fn.extend({
closest: function( selector, context ) {
(function(jQuery){
var parsedCache = [],
_filter = jQuery.filter;
jQuery.filter = jQuery.multiFilter = function( expr, elems, not ) {
var parsed = [], split, re, matches = [], match, l, i;
// We are looking for simple selectors of the form "div", ".class" or "div.class"
// We'll try to minimize the extra-processing for complex selectors