25
Sep

Improve VIM Tips Wiki

The ads on vim’s tips wiki are super annoying and distracting, and sometimes quite vulgar/risque. I don’t want to see video ads when I’m trying to solve a programming problem.

Here’s how I fixed wikia in Google Chrome:

  1. Get the “Personalized Web Options” plugin.
  2. Match the url ^http://vim.wikia.com/
  3. Check “Try to prevent web pages from injecting … document.write() calls.”
  4. Add the following CSS

CSS to fix http://vim.wikia.com/

    .WikiaMainContent { width: 100%; }
    .WikiaRail,
    #WikiaArticleBottomAd,
    #TOP_LEADERBOARD,
    #WikiaFooter,
    .sponsorwrapper { display: none; }
14
Aug

Shrink from what might offend…

by jon beebe in Spiritual

I came across a very familiar passage in the Bible today, from Philippians 2:12. From the NIV it reads:

12 Therefore, my dear friends, as you have always obeyed—not only in my presence, but now much more in my absence—continue to work out your salvation with fear and trembling

This is very familiar to me, and chances are if you’ve been around the Bible for more than a few days you’ve come across it too. For some reason I decided to check it out in another version and I was surprised to find this in the Amplified translation:

12 Therefore, my dear ones, as you have always obeyed [my suggestions], so now, not only [with the enthusiasm you would show] in my presence but much more because I am absent, work out (cultivate, carry out to the goal, and fully complete) your own salvation with reverence and awe and trembling (self-distrust, with serious caution, tenderness of conscience, watchfulness against temptation, timidly shrinking from whatever might offend God and discredit the name of Christ).

What caught my attention is how it amplified “trembling” to mean “self-distrust, with serious caution, tenderness of conscience, watchfulness against temptation, timidly shrinking from whatever might offend God and discredit the name of Christ.”

I’d love for people to remember me as someone who timidly shrinks from anything offending God and discrediting the name of Christ.

8
Jul

Fighting Germans with Web Apps

by jon beebe in Web Development

My boss likes using WWII analogies when describing our work. Today we’re in Africa, fighting Rommel in the Desert.

23
Mar

Is the University of Phoenix a scam?

by jon beebe in Thoughts

In an unfortunate turn of events, my wife (who’s a straight-A student) was booted from her masters program. She’s been diligently following up with her UoP mentor and the lead teacher (who’s responsible for failing her from Portfolio II).

It raises some very serious concerns. How can a school remove a straight-A student from their program? And how can we take the University of Phoenix seriously when their commentary on their decision directly contradicts the comments of my wife’s previous professors?

I hope and pray that this gets resolved. Meanwhile we can all follow the journey on my wife’s blog.

28
Feb

I wish I’d read this 15 years ago…

by jon beebe in Thoughts

“Formal education is merely a biased entitiy designed to propagate favoured ideas. Few teach how to think rationally, but instead teach us to rely on indoctrination and memorization. Consequently, formal education has handed down, from one generation to the next, theories which not only clash with the reality of events, but insure confusion for decades to come.”

— Martin Armstrong in The Final Confrontation, a bewildered central bank, 1988. Accessed from The Tipping Point.

29
Dec

draw.txt

by jon beebe in Web Development

This is something that’ll mostly interest web-developers, programmers, and those that geek-out over strange uses of technology.

In an effort to learn the finer aspects of the Mootools javascript library, I coded draw.txt, an application that lets you draw a text document.

Keep reading »

4
Oct

Javascript Getters and Setters

by jon beebe in Web Development

I’m working on a javascript project that requires the use of a language feature I’ve yet to use: getters and setters. When trying to implement them I quickly ran into an age-old snafu: web-browsers are consistently inconsistent in their feature implementations.

The Problem

The two most helpful discussions on javascript getters and setters come from John Resig and Robert Nyman. You’ll quickly learn when using getters and setters they are not defined the same in every browser. Here’s a brief summary of browser capabilities relevant to my research:

What’d I tell ya? The world of a web-developer, consistently inconsistent.

The Solution

I like the convenience of every object having a common interface (such as Object.defineProperty) so I added a bit of Object.prototype sugar.

/**
 * A generic way to define a getter/setter for
 * objects in both the legacy Mozilla way and the new ECMA standard way,
 * which should work in I.E. with DOM Elements, but not js objects.
 *
 * more info on javascript getters and setters:
 * John Resig: http://bit.ly/resig-js-gs-2007
 * Robert Nyman: http://bit.ly/nyman-js-gs-2009
 *
 * @author somethingkindawierd@gmail.com (Jon Beebe)
 * @param {string} label The property name to get/set.
 * @param {function} getter The get function.
 * @param {function} setter The set function.
 */
Object.prototype.addProperty = function(label, getter, setter) {

  if (Object.defineProperty) {
    Object.defineProperty(
        this,
        label,
        {
          get: getter,
          set: setter
        }
    );
  }
  else {
    if (getter) {
      this.__defineGetter__(label, getter);
    }
    if (setter) {
      this.__defineSetter__(label, setter);
    }
  }

};

/**
 * A generic way to define a group of getters/setters for objects
 *
 * @author somethingkindawierd@gmail.com (Jon Beebe)
 * @param {object} p Set of properties and their getter/setter methods.
 */
Object.prototype.addProperties = function(p) {

  for (var label in p) {
    if (p.hasOwnProperty(label)) {
      this.addProperty(label, p[label].get, p[label].set);
    }
  }

};

With these methods in place we can now add new getters and setters to our objects or functions using code like this:

var Base = function(x, y) {

  // Private properties
  var x_,
      y_;

  // Define our getters and setters
  this.addProperties({
    x: {
      get: function() {
        return x_;
      },
      set: function(val) {
        x_ = val;
      }
    },
    y: {
      get: function() {
        return y_;
      },
      set: function(val) {
        y_ = val;
      }
    }
  });

  // more code here as necessary ...

};

// add to the Base.prototype here

The entire solution can be found on github as part of my research on object oriented javascript and inheritance patterns. Please feel free to peruse the code, use it as needed, and if you have a suggestion or bug-fix, fork it!

2
Oct

Fix Ubuntu 10.04 popping sound on MacBook

by jon beebe in Linux

If you’re running Ubuntu 9.10 or 10.04 on your MacBook you’ve probably experienced that odd popping sound eminating from the speakers when playing music or video.

I’ve found for my MacBook 2,1 changing the selected device profile in the sound preferences permanently fixed this issue. Now I have crisp, clear surround sound as expected.

Go to System → Prefences → Sound → Hardware (tab)

The Profile selection was defaulted to  ”Analogue Stereo Duplex”. I changed this to “Analog Surround 4.0 Output” and the sound cleared up. And an added bonus: I now have control over the fading between front and rear surround settings.

Change sound settings to Analog Surround 4.0 Output to fix popping sound in Ubuntu on MacBook

Change sound settings to "Analog Surround 4.0 Output" to fix popping sound in Ubuntu on MacBook

29
Jul

My first github project!

Dynamic page head

Over the past few years I’ve had a need for dynamically adding/modifying the html <head> element as php builds pages. I created a singleton object for this purpose, and I’ve finally massaged the code to a point where it’s ready to release into the wild. My dynamic page head class comes with some convenient features such as:

  • Add linked js/css and inline scripts and styles
  • Optionally render javascript to the bottom of the DOM, as Yahoo’s YSlow recommends
  • Merge files together, reducing requests to the server
  • Minimize css with csstidy or YUI Compressor
  • Minimize javascript with jsmin or YUI Compressor
  • Optionally include/exclude any css or js asset from merging/minimization
    • This is useful when including items such as TinyMCE, which uses javascript to include other assets. Minimization will break relative references to these items because the TinyMCE script will, mosty likely, not live in the same directory once minimized.
  • Convenience functions for certain items such as nocache metadata
  • Operate in xhtml (default) or html mode, rendering valid markup for either

Check it out at github

18
May

Battery always 0% in Ubuntu 10.04

by ubuntu productivity in Computers, Linux

Update, 22 May, 2010. While the fix below was working for a while, it eventually stopped as well. Then I came across this article at Apple. Evidently, when the battery reports 0%, it is a hardware error and the System Management Controller must be reset. It’s quite simple: Keep reading »

Switch to our mobile site