Extend jQuery the Easy Way


I have an issue with not being able to read my own code. Other developers, I am sure, can relate. Especially when I have put a great deal of effort into a single file. Often this is a JavaScript file that has a whole lot of ability but not a whole lot of functionality. jQuery is one of my favorite frameworks. It is easy to use and easy to attach to. So for example, let us say I have a function that needs to be able to be triggered on a DOM element. I could send “this” to the function over and over again. Or I could let jQuery do all the work for me. I am lazy, after all.

jQuery.fn.destroy = function() {
  return this.each(function() {

With this, I can remove any DOM element by calling destroy. Pointless, yes, but it works and shows what I mean.

Simple enough. But what if I want options. What if I need to do more things but I should really only take one name from jQuery, right? What about this?

jQuery.fn.stuff = function(opt) {
  return this.each(function() {
    switch(opt) {
      case 'destroy':
      case 'alert':

Now, I can destroy or I can alert the user that the DOM element was a TABLE. Again, this is an example and not something anyone would actually use.

But, what if I needed to add lots of functionality and my function just ended up overflowing with an annoying level of switch statements. Eventually, I get to the point where I cannot read my own code or find the place in my code that I need to adjust.

Now for my easier, cleaner solution.

First, I create an object. In this example, we will name my object Jeff.

var jeff = {};

Now, let me give Jeff a function.

// This is a pointless function to remove DOM elements.
jeff.destroy = function(obj) {
  return obj;

Jeff needs another function.

// This is a pointless function to send a message.
jeff.alert = function(obj) {
  return obj;

I can repeat this forever with as many functions as I want:

  1. Commenting is easy and clean
  2. There is no ugly switch statement

But what does this have to do with jQuery? Here is my easier jQuery.

jQuery.fn.jeff = function(opt) {
  // Unlike the highlander, there can be more than one.
  return this.each(function(){
    // We like options that make sense.
    if(typeof opt === 'string') {
      // Make sure Jeff knows what to do first.
      if(typeof jeff[opt] === 'function') {
        // Tell Jeff what to do.
      else {
        // Let the user know that Jeff doesn't know that trick.
        console.error('Jeff does not have a function named "' + opt + '".');
    else {
      // The user sent Jeff something silly.
      console.error('Jeff is really confused by what you are trying to do.');

And there we have it.

Routing in ASP.Net without 404 for file extensions

Ran into an interesting issue today. We have an application that I am building. One of the pieces of this is application is the ability to download file, but, since security is always important, the file isn’t where the URL says it is. Using ASP.Net routing, I can say it is in one place, when it is really somewhere else and then just output the binary data as a response. Except for that pesky file extension. If the URL doesn’t have a file extension, everything is fine. If the URL has a file extension, the StaticFile Handler takes over and gives me a 404. After far too much Googling for a work around and finding lots of almost functionality answers, I came up with this.

First, determine the path that will never have files. We can use /documents for example.  What I am saying is, the URL http://www.example.com/documents/ will never actually have any files. In fact, in my solution, the documents directory doesn’t even exist.

Now, in your web.config, add the following:

<location path="documents">
            <remove name="StaticFile"/>
            <add name="WildCardRequestHandler" verb="GET" path="*" type="System.Web.Handlers.TransferRequestHandler"/>

Now, your routes will work as expected even when there is an extension but only for that path. In other words, going to http://www.example.com/documents/test.txt will allow your handler to handle it instead of having a 404 for a file you already knew didn’t exist.

My letter to Edgepark Medical Supplies

Edgepark Medical Supplies
1810 Summit Commerce Park
Twinsburg, OH 44087

To whom it may concern,

I am a customer, and I am supposed to receive a shipment of Omnipod pods every 3 months. When I started running low, I called to verify that everything was in order for my shipment. I was told everything was fine and it would be delivered in July.  It is now July 25th, and I am wearing my last pod. On Sunday, it will expire and be useless. When I called customer service to find out where my package was, I was told that the shipment had been canceled. After being transferred twice, I was able to talk to someone that knew the reason my shipment was canceled. She told me my shipment was canceled because I didn’t respond to a voicemail. I never received a voicemail and that is beside the point.

I am type 1 diabetic. I’m going to give you a brief explanation of what that means because apparently Edgepark doesn’t already know. It means, I do not produce insulin. Without injecting insulin into my body, my blood sugar will continue to increase until I have a stroke.  Basically, without insulin, I’m risking death. Insulin gets into my body using the pods I am supposed to receive from Edgepark. These pods are good for 3 days. After that, they are useless. If I run out of pods, my alternative is trying to manually do what the pod does which means giving myself 0.625 units of insulin every hour using a syringe. If you have ever seen a syringe, 0.625 is not a value you can measure out properly. Also, though I do have some syringes in case of emergency, I only have about 20 at any given time as I generally do not use them. I have the pods for this. You may be thinking, “I know people who don’t use a pump.” That’s correct. But those people have two types of insulin. Pump users only have 1 type of insulin.  The second type of insulin is long lasting and used to balance the diabetic throughout the day. Without this second type of insulin, in order to recreate what the pump does, I would need the 0.625 units of insulin every hour. I hope this makes sense.

I am sure, by now, you have realized that I am not happy. I am livid. I called today to find out where the order was that I was promised and found out it was canceled because I did not respond to a voicemail I did not receive. Let me make sure I understand this correctly. Edgepark’s policy is to leave one voicemail. If you do not receive a call back, you just cancel the order of the medicine that my life depends on. There are no other attempts to make sure that I do not want the medicine that allows me to live. You assume, that as an insulin dependent diabetic, I would rather die than return your call. Assuming you made this assumption, should you not, at the very least, attempt to let me know that you have canceled the order that keeps me alive?  How about sending me a letter?  Assuming you had the wrong number and no other way to communicate with me, how about sending me a letter. At least I would have received that in time to fix the problem. But you did not have the wrong number as I verified it when I found out that you signed my death certificate.

I want to know how I can trust your company. What is Edgepark Medical Supply going to do to ensure this does not happen again? I seriously have no idea how I am going to survive until Tuesday. My doctor’s office is closed, I don’t have a diabetes educator, and the other diabetics I know in the area do not use Omnipod and, thankfully, do not use Edgepark to supply them.

Extremely dissatisfied customer,


Shaun Thomas Frisbee

Measure Chlorine Levels in a Tsunami

Bloody Censor

No, we do not have pink lights in our house. The discoloration you see is dried blood. I have been wearing it for less than a week and was tired of the blood sugar levels of ???, so I went to change it and was showered by dark red paint chips.

For those that don’t know, the picture is a sensor for my continuous glucose monitor. The color if it normally is transparent with white tape. When the CGM, or mine anyway, has trouble determining blood sugar it gives a reading of ???.

That has been my blood sugar all week. My readings have been few and far between and always at some surprising and erroneous level. That’s because it was trying to check the chlorine levels of a tsunami.

To Pump or Not to Pump

Pump and CGM

I don’t meet, in person, very many people living with Type 1 diabetes. In fact, there is only one other that I see regularly. There are others in the area. You just have to participate more. On the rare occurrence that I do, it seems that many of us suffered the same dilemma.  Should I get the pump?  Should I get a CGM? Is there enough room on your toothpick-shaped body to have two devices?

Apparently, many of us ask these same questions.  I was very resistant for years. I always thought that I would need better control of my diabetes before I thought about adding expensive devices to the equation. I was worried about not being able to swim or shower because I was always plugged in. He was worried that he didn’t enough fat on his body to accommodate two devices. I now use both a pump and a CGM and wear them 24/7. They have dramatically changed my life with diabetes. I have much better control of my blood sugar. No where near as good as mine was. And I don’t resist eating because I don’t feel like taking a shot or dealing with my disease.  I no longer have the strange lows or highs that I cannot explain my basal insulin isn’t adjusted just right.

My endocrinologist, who I think is excellent, did not seem keen on me getting a pump.  He didn’t tell me not or that I shouldn’t; it just appeared that it wasn’t something he felt I needed. He did seem very keen on the CGM though. Probably because your A1C was consistently pushing 10. A few years ago, I found Keri Sparling’s blog, Six Until Me, and felt that I had found a kindred spirit of sorts.  I had found someone else that knew exactly what life with diabetes was like.  She had just had her baby and my wife had recently delivered Squishy as well.  As I have never had a c-section or attempted breast-feeding, I could not relate to everything  in her blog, but many things that were affecting her were also affecting me. The one thing in my life, that seemed to be missing from hers, was the annoying need to constantly stab myself with a needle. The hard bumps that kept forming in my abdomen and hips because I could not find new places with enough fat to give myself another injection. The irritation of accidentally leaving my insulin at home or not bring enough with me for the day. Not that those situations do not affect a person using the pump, but those were affecting me constantly.

I finally got my CGM in February 2012. It only took a moment for me to see the benefits of it. My A1C immediately started dropping. Just having an alarm to tell me when I was in trouble or being able to see what my eating habits were doing to my blood sugar took my A1C from a 9.1 to 6.7 in a few months. No, my blood sugar is not perfect and I still have my ups and downs, but I would not go back to the way things were. In fact, my endocrinologist asked me at my last visit, which device do I think contributed the most to my improved A1C. I told him flat-out, the CGM. The pump is nice and I wouldn’t give it up either, but the CGM is the reason my A1C is better.

But, if you have been keeping up, I have a pump as well. Which must mean there is something I like about it. I don’t know about every pump, I know about my pump.  So if you are thinking about pumping insulin into your body, some research into what the different pumps offer and what the pros and cons of each are is an important step. One he skipped. I chose the OneTouch Ping from Animas. And it is true, I did not do my research.  What I saw was something from my favorite diabetes blogger talking about her Ping and being able to swim without worrying.  I cannot find it now, or I would have linked to it. Mostly because he can’t remember if it was a video, a blog post, or advertisement on the Animas website. I love playing in the water.  My girls love playing in the water. We always live near a pool because they love the water. So I needed the one that allowed Kerri to go in the ocean without worrying. Don’t get me wrong; I love my Ping. And for those of you with the same list of concerns that I had, here are the responses I wish someone would have given me, as they apply to me and my Ping:

I will have to keep a close eye on the clock when playing in the water because I won’t be able to take my pump with me.

Not true. Many of the pumps are waterproof.  I spend hours in the water with the girls and don’t even think about my diabetes unless I feel light-headed or start to smell that funny your-blood-sugar-is-outrageously-high smell.

I won’t be able to take long showers any more.

So, as it turns out, the pump isn’t constantly delivering insulin to your body.  You tell it when you eat to give your bolus just like you would do with your regulated stabbings.  The difference is, no stabbing. What it does do, is give you a little bit every hour to keep your regulated when you are not eating.  And if you are taking a long shower and miss that one basal, which for me is 0.625 units of insulin, who cares.  Seriously, it isn’t a big deal. I don’t even think my body notices if it only misses one.

I’m too skinny. I’ll have nowhere to put it.

You actually have more options than you think. Areas that are difficult to reach are now options because you only have to reach it once. The love handles work great for me. Love handles? Those are not nearly big enough to be handles.

How will I have naked fun when I must have something to clip the pump onto?

This is exactly the same response as the one for the shower. Which could also be naked fun. In fact, this may even be better.  You are replacing the small amount of insulin you are missing with physical exercise.

Don’t be afraid of the devices. They are awesome and have made a world of difference in my life.  If you really cannot get around your fears, start with the CGM. Once you realize how awesome it is, you will be rushing to get plugged into a pump.

Red Herring

Everyday, I feel a bit older. Everyday, you are a bit older. I mean that I physical feel it. I am 32, and I often feel like I am on the fast track to a nursing home. Today, I had an appointment with a cardiologist.  Apparently, individuals with Ehlers-Danlos syndrome are at risk for heart problems. I had this appointment today, and from this appointment, I have to make 3 more. I heard they sell them in bulk as Sam’s Club. One for a CT scan of my aorta to make sure it is not super sized; one for an echo-cardiogram to make sure my heart is pumping like it should;  and one for a sleep study because I may have sleep apnea. He may not have sleep apnea, but he definitely has some sort of sleep disorder. I miss the days when I went to the doctor, he told me everything was fine, and there were no follow up appointments. It’s like taking your Frizbian to the mechanic. “While we were replacing your wiper blades, we realized that we had to rebuild the transmission.” Now days, when I go to a doctor, I leave with at least 1 more appointment to schedule.  Thankfully, despite memory problems being one of the symptoms of ADHD, I do not get distracted SQUIRRELI am surprised her remembered the movie reference.

So, about red herrings.

They don’t exist?

 The history behind the red herring, like most of history, is a little muddled.

If only historians would have had a blog like this to right down the origins of popular phrases.

 Some believe that the strong smell of the red herring was used to teach dogs how to following a specific scent.  The red herring was used as a distraction to throw them off course or teach them to focus. 

Or to teach them that fish is yummy.

In my case, diabetes is the red herring. When I first moved to Virginia my A1C was over 8.

It was over 9, but who’s counting?

 I was having a number of symptoms that appeared, to me anyway, to be unrelated. I was sent to different specialists for each symptom, and each specialist told me that once I my blood sugar was under control, the symptoms would go away.

This was after the through examination which consisted of, “So, you have diabetes?”

 This year, I started pumping.

Should I cue the choir of angels?

  One of the requirements of my diabetes educator was that I have a good record of blood glucose, insulin, and carbohydrate numbers before I started using the pump.  Doing this actually brought my A1C down dramatically.

Paying attention helps? No. Surely that is not true.

  I began to have much better control.  Control which only improved after I started using the pump. The symptoms should start subsiding, right? Well, I assumed it would not be instant.  I did not start out with a high A1C.

Despite his early attempts of treating diabetes with cranberry juice.

  I spent a lot of time building up to that number.  What I did not expect is for things to start getting worse.  It seems that the more control I gained over my blood sugar, the more evident my symptoms became.  It is now to the point that just standing for a long time or driving causes a great deal of pain in my back. I cannot stand for long periods of time because my legs feel weak, and I start stumbling like a drunk.

 A reaction he also has to a teaspoon of cough syrup.

I am not certain what the moral of this story is.

Don’t eat red herring?

 I guess it could be, if your doctors seem to blame your diabetes for everything, you may want to get a second opinion. Since we moved recently, we have changed clinics and our new primary care physician is trying to pick up on the real scent (and he is also the one that referred to my diabetes as a red herring). Hopefully, in the next few months, I will actually know what is wrong and be able to at least treat it. 

You are all welcome to send me donations to find a cure for the common Frizbian.

Pony Rides and Bad Drivers

I know.  Its been a while.  I keep planning on writing but most days I am just so exhausted that watching TV is difficult. I am sort of on vacation.  Mamma is in Italy for a friend’s wedding, and I’m at home with the kids.

Last Saturday we went to a farmer’s market where we had tickets for a pony ride. That was a flee market. Actually, we had vouchers so that we could get tickets for a pony ride. I went to hand the lady at the near the ponies the tickets that I had printed from Living Social and she let me know that I had to go to the information tent to redeem my tickets and that the piece paper I had was just a voucher. When we arrived at the line for the information tent, it became quickly apparent that this wasn’t well planned. He bought tickets for a spectacular line.  We were in line for an hour and half. I didn’t bring the stroller because I didn’t think we would be standing around that long. If you have ever stood in line for more than ten minutes with a two year old trying to escape and a seven year old asking questions about why we have to stay in line, you can imagine the suffering.

We finally got our tickets and I could see that the hour and half line had now grown to well over three hours and was slightly thankful that we were done with that.  We took our tickets back to the pony ride and stood in line for another half hour. The kids loved the ponies for the entire three minutes.

The ponies were kept in area away from the rest of the market so after the rides we started walking back towards the market from the ponies, we passed a bounce house.  We stopped so that Tata could jump around a bit. Anyone else thinking about House of Pain.  Turns out we needed tickets.  I asked the guy if the tickets were purchased at the information tent and when he said yes, I gave Tata a choice: wait in line again or go to McDonald’s.  She didn’t even take a second to think. Duh. McDonald’s was our next destination.

Dent in car fender

The nearest McDonald’s was in a small shopping center with one entrance from the main road.  The entrance was a long, two way street that lead to a parking lot, but just inside that entrance was an Exxon gas station.  Apparently, without a stop sign, some people do not realize they have to stop. Someone exiting the Exxon ran right into us as we were coming down the road. Then, he drove away quickly. I did what any intelligent father with two small children in the car would do; I chased after him while honking my horn until he stopped. Logical? At which point he proceeded to tell me that he had the right of way and that he was just looking for a parking space and that he couldn’t stop in the middle of the road.  My brain was overloading. He had the right of way? I have never ever seen a gas station where the person exiting has the right of way. He was looking for a parking space? We were five feet from a parking lot. Couldn’t stop in the middle of the road? He speed up.  But I couldn’t articulate any of that. In fact, my brain and tongue seemed to be disconnected all of a sudden.  And then it hit me. My blood sugar was going to be low, right now. Right now, while I have this man yelling at me because he was the first man in history to leave an Exxon with the right of way. Right now, while I was trying to find the police department phone number of my BlackBerry. Right now, with Squishy in the back of the minivan going, “Wha happent Papa?”

One of the ways that diabetes can be helpful is, apparently, it completely readjusts people’s negative attitudes towards you when they think you are going to die. Suddenly, this guy was now my best friend and was asking what he could do to help. Then he noticed the kids in the back and started apologizing, asking if they were okay. My head was still spinning as I was chewing on my favorite correction medicine, SweetTarts. I called USAA and started filing the claim as I waited for my blood sugar to return back to normal.

Day 3 with Dex

My Dexcom Continuous Glucose Monitor (CGM) arrived on Friday. I plugged it in for 3 hours of charging and immediately started getting myself connected. He was like a kid in a candy store. Metaphorically speaking; of course. It has only been 3 days, and I have already learned a great deal from the little egg shaped device. What I thought my blood sugar was doing goes about like this:

  1. I take my basal (Lantus) insulin at night keeping me steady for most of the night and my blood sugar would start dropping just before 5:30 AM (when I normally eat breakfast). Except on the weekends when he would wake up at 9 with a BG of 50.
  2. At 5:30 AM, I would take my bolus (Novalog) insulin for breakfast and eat some cereal with milk. Some? His cereal bowl is the one normal people use to mix cakes with.
  3. Around 11:30 AM, I would start to feel a little low and then I would test and I would be some where between 60 and 80. I would bolus and eat lunch. Usually, he skips step 3 all together.
  4. Around 6PM I would make dinner for myself and the kids, bolus (which I always seems to under estimate the bolus needed) and spend the rest of the night bolusing until bed time trying to figure out why my estimate was so badly off.

That is what I thought was happening. Dexcom shed a little light on the situation. Any more light and his nose hairs would catch fire.

  1. I take my basal insulin at night and then steadily drop until around 5:30AM. The trend looks a lot like a slide.
  2. At 5:30 AM, I take my bolus insulin for breakfast and east some cereal with milk. Then, I spike to about 350.
  3. I slowly, but steadily, fall back down to between 60 and 80 at around 11:30 AM. I bolus and eat lunch. Then, I spike to 300 or better and about a half hour later drop to around 120.
  4. Slowly go down to about 112 and then at 6PM I make dinner for myself an the kids.  I bolus (which I still seem to under estimate) and spend the rest of the night steadily climbing higher and higher while bolusing to try to get back off the escalator.

CGM reading 255

What is that all about? Poor diabetes control? Talk about total shock. I had no idea my blood sugar was bouncing like that. He should really test more. I look at the two lines on the Dexcom my blood sugar is doing everything it can to stay out of them. And what is my basal doing? Drawing; like on an Etch A Sketch. When I am sleeping, my blood sugar is dropping like a rock and after dinner, my blood sugar just holds steady at 250. Tonight, I had two tuna fish sandwiches and some pork and beans. I would guess about 110 grams of carbohydrates. That is roughly 7 units of insulin for me. That was my bolus at 6:30.  After eating dinner, Dex started freaking out and my trend was raising to the top of the meter. I have been taking 3 units of Novalog every half since and my trend is almost a straight line. Not going up; not going down. At least he has some consistency. Just piling on the Novalog and the line isn’t budging. But I’ll bet if I take my basal dosage, I will be heading back down again. Its like before lunch my basal is trying to help me remember what hypoglycemia feels like and after dinner we are reminiscing about hyperglycemia. Have some ice cream. I’ll bet that will get that line moving. Thoughts? Anyone? PICK ME! PICK ME! Anyone else?

What would you do with a diabetes-free day?

No diabetes

Emily Coles on Tudiabetes asked the PWDs of the DOC, “What would you do with a diabetes-free day?” I tried to think of something interesting; something amazing; something that would just be so much cooler than anyone else’s answer. He tried to think. Sadly, I kept coming back to some fairly normal answers.

For starters, I’m sleeping until 10AM. I’m not getting up because my blood sugar is going to be too low if I sleep any more. I’m not rushing to check my blood sugar at 6AM because I usually eat breakfast at that time. I’m not getting up to pee in the middle of the night and wondering if I that means my blood sugar is high. Not only that, but Mamma is sleeping too. I know she worries about me at night especially.

I’m going to eat and play. I’m filling my freezer full of ice cream, and I’m filling my dinning room full of pizza. I’m making up for every birthday party where Papá had to sit down for a second because we played to much, or Papá was getting angry because he ate too much pizza and ice cream. Tata, Squishy, and I are playing until they both pass out from pure exhaustion.

I’m hiring a baby sitter to watch the girls after they go to bed, and I’m taking Mamma to dinner and dancing. That could get ugly. I don’t care. Mamma loves to dance, and he makes the robot look graceful. And it would be nice to be able to give her my full attention when she is trying to show me how, instead of me trying to determine if I have enough sugar to make it through the song.

I’m caring candy in my pocket, and I’m going to eat it just because I want to. He does that already. No, I eat it because my hands and mouth have been working together for so long, they often forget to tell my brain what they are doing. Then, I get to worry about how much I ate, because I wasn’t counting the pieces or Reese’s while I was eating them.

The truth of the matter is, if I have a diabetes free day, I am giving as much of it to my family as possible. I don’t believe for a second that I am the one that suffers the most from my diabetes. When I’m low, I don’t even know I have diabetes, and when I am high, I get so angry I couldn’t care about it. All the while, my family gets to watch from the line of scrimmage. It may be my pancreas that has gone into early retirement, but my wife and my daughters are the ones suffering the most.

Something to Laugh About

So tonight while chatting and listening at DMSA Live, I was reading the other blogs that I never have time to read and SUM had posted a video with a link back to a previous post.  I’m posting them both so that I never forget them.