Skip to content

Instantly share code, notes, and snippets.

View timwhitlock's full-sized avatar

Tim Whitlock timwhitlock

View GitHub Profile
@timwhitlock
timwhitlock / dict.js
Last active January 6, 2021 19:01
Searchable JavaScript Dictionary
/**
* Searchable JavaScript dictionary.
*
* Usage:
* var dict = require('path/to/this').create();
* dict.add( 'somedata', 'Text to index' );
* var items = dict.find('text');
*/
exports.create = function(){
return new Dict;
@timwhitlock
timwhitlock / require_wp_db_patch.php
Created January 27, 2012 10:48
What require_wp_db function in Wordpress would look like, if it worked
<?php
function require_wp_db() {
global $wpdb;
if ( isset($wpdb) ){
return;
}
// Should check for override db.php file first
// - including both means fatal error on duplicate class
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ){
require_once( WP_CONTENT_DIR . '/db.php' );
retweet.html
rt-loader.js