Deploying Storybook via Gitlab Pipeline via SFTP
This is an update to my previous script to deploy Storybook to S3 via Gitlab Pipelines. We're running a dev server on EC2 and I wanted to be able to deploy the project using SFTP. This assumes you already created a new user account on the FTP server.
Create an SSH key on your local machine and save it without a password using the following command:
How to Capture Google Analytics Before Redirect
Up until today, everyone I know has struggled to capture a Google Analytics event on redirect links. We've all had to come up with hacks and workarounds to ensure that the initial landing page is tracked. Today I finally figured out a solution that works. Google analytics now offers a callback event which lets you fire the redirect (or any custom functionality after the main tracking event fires. The snippet to add after the Google analytics tracking code setup is below:
Reading JSON through JQuery from Cross Domain ASP.NET Web Service
Recently I had an issue with JQuery and accessing JSON from a cross domain ASP.NET Web Service. After much googling, I stumbled upon many articles that provided no fix that would solve the issue. Every sample I found was some derivative of the following code:
Round Up to Whole Numbers in Excel (10s, 100s, 1000s, etc)
After years of using Excel, I realized today I have never had to round up to the nearest whole number before - until today that is. I was organizing my finances and realized that I wanted to round some of the amounts up to the nearest 10. So to round to the nearest decimal place in Excel, the formula is: =ROUNDUP([Range],[Position]) Count the number of places after the 0 to round to and set [Position] to that value So if you had 1234.25 in Cell A1 and wanted to round up to the nearest cent, =ROUNDUP(A1, 1) would produce 1234.30.
SSL, jQuery, and CDN
I just got whacked by a minor bug with SSL and the Google CDN (totally my fault, not theirs). I stuck the reference to the CDN in my master page not realizing one of the pages would be served up as secured by the vendor due to compliance issues. It made it through all testing because none of the staging/dev environments were configured for SSL and I was not made aware of the fact that we'd be serving the page up through SSL. Internet Explorer 8 prompted users about the insecure content before rendering the page. In their infinite wisdom, Microsoft decided to implement a new workflow for insecure content where the content is ignored and the page renders immediately with the unsecured content ignored. Since jQuery was used on multiple parts of the form, the site essentially broke. Google Chrome and Firefox seem to recognize the CDN as a trusted source and render the page as expected. To fix the site, I added a javascript check to set the appropriate prefix to the CDN call:
“This is BMW. We don’t negotiate.”
Following my ordeal with Ford, I started my drive home and drove past a BMW dealership. I decided to check it out and pulled into the lot, parked, and walked inside. My mother and I walked around looking at the cars and nobody walked over to help for a good 15 minutes. Finally I walked over to the front desk and the girl looked up and asked what I wanted. I said “I’m looking to purchase a BMW.” She suddenly had a smile on her face and said “OH! One second, let me see whom I can get to help you.”
The girl made a phone call and spoke softly and then followed by “uh huh. Ok.” and then looked up to me and said “One of the sales reps will be right with you.” I nodded and gave her my thanks and walked back to the car I was looking at. I couldn’t help but feel like the lack of anyone coming to help and her initial attitude was caused by some sort of racial profiling but I could totally be off base on that (but based on prior experiences, I’m more than likely correct). Finally a salesman came out, introduced himself and then asked how he could help. I explained I was looking for a 328xi to which he responded we should step into his office. He started filling out some paperwork to which I stated “Wait, we haven’t discussed anything yet. Why are you filling out forms already?” to which he replied ”This will save time. You obviously seem like you’ve decided on the car you want.” I eyed him suspiciously and after he filled in the paperwork, he excused himself and took the paperwork and walked away. I looked at my mother and whispered “I seriously think he’s running a credit check to see if I can get the car.” We were both agitated already from our previous experience not 30 minutes prior. I’ve purchased a few cars in the past, for both myself and my parents and have never encountered the type of obnoxious behaviors I’ve run into that day.
So he comes back, sans paperwork and sits down. He starts asking me what I’m looking for and is interrupted by a phone call. He says “Excuse me one second, that’s my wife.” and I happened to see that the phone was an extension internally. I listened very carefully and heard “The credit is seriously excellent. They can buy the 7 series if they wanted.” to which he replied “Wonderful! OK, I have to go, I’ll talk to you later.” and turned to us. “Sorry, she wanted to let me know dinner would be waiting for me when I got home.”
I’m going to shorten the story but we discussed what I wanted, and he said he had the car in the lot and made me an offer. I countered and he looked at me and said “This is BMW. We don’t negotiate.” I was totally surprised and countered with “I know for a fact that’s not true as four people I know negotiated before they bought their car.” He said “They might have got a good special, but the best I can do for you is give you a 1.99% financing. It ends tomorrow so we have to sign today.” I said “If I sign, how long do I have before I can cancel the deal with no penalties?” He said “You have until you take delivery.”
“Let’s go look at the car.” I got in and drove it a bit, and it handled great. Even my mother was impressed how it handled, but it had no options or features. I wasn’t so thrilled since I was giving up everything I actually wanted and not getting a great deal. In the beginning, I told him I wanted one thing no matter what – a hookup for my iphone to connect to the Bluetooth and to play music through the radio. If I have to compromise, that’s the one thing I refuse to give up. We talked as I drove the car around the lot a bit and he made comments about it’s power, acceleration, etc. Finally I got out of the car and began to look for the hookup for the iphone. When he inquired as to what I was searching for, I said “The iphone hookup which you guaranteed came with the car. I don’t see it anywhere.”
He said “It’s right…” and opened the center console followed by “uh-oh”. “Wow…ok…looks like the car doesn’t have the connection after all…not a big deal. You can get an aftermarket part. Let’s go finish the paperwork.”
I looked at him and point blank said “No. The deal’s off. I told you flat out that I’m giving up every option I wanted with this car. I’m settling for a lesser car and the ONE thing I REFUSE to give up is the one thing you guaranteed to be included. Now you’re telling me it’s not and I have to spend MORE money? I’m done.”
He replied “You’d really walk away from the deal for just this?”. “I already said deal’s off.” “OK, OK. Let me go talk to my boss. See what I can do.”
We go inside and he walks inside the manager’s office. He says “I have a customer who wants to purchase a car but he wants to hook up an iphone to it. The car is supposed to have the part but doesn’t. He’s ready to walk away on the deal.” I heard the manager say “For a $30 cable? Give it to him!”
The sales guy comes out and says “I convinced my manager to give you the part. It’s a $650 part that we're giving you for free.”
We walked back to the office and sat down to sign the paperwork. Again I asked, “Just to double check, if I sign, how long do I have before I can cancel the deal with no penalties?” He said “I’m so confident you’re going to want the car, that you can break it until you take delivery of the vehicle.”
I signed the paperwork and told my friend what happened. He had been researching cars with me and said I should check out the Hyundai Genesis. He went with me to test drive the car the following Monday. We were both seriously impressed with the car and how it handled. I told the salesman that I’m looking to pay X for all the features and I don’t really need the car. If he can meet it, I’ll sign and drive away. If not, no hard feelings and I’ll walk away. He said “Wow, that’s low…but let me see what I can do.” He went to talk to his manager and came back after about 10 minutes. He said “My manager is calling the bank to see if they’ll approve it. It’s a real low offer and he doesn’t think they’ll approve but we never know.” Five minutes later, the manager comes over, shakes my hand and says “Congratulations. I hope you really enjoy your car. It’s the pride of our fleet.”
I called the BMW dealership and spoke to the salesman to let him know I was cancelling the deal. He responded “What can I do to keep your business?” I said “Honestly? There’s not much. You’re not going to beat the price.” He said “What kind of car are you getting and how much are you paying monthly?” I said “Hyundai Genesis and x dollars.” He said “You’re giving up a BMW for a HYUNDAI?” in shock. I chuckled and said “Not just any Hyundai, one that ranks higher than yours, is cheaper, more room in every direction, has every option you offer, and uses regular gas instead of premium.” He said “Is there anything that I could do to make you reconsider?” to which I calmly replied “Sorry, you’re BMW. You don’t negotiate.”
Wherein buying American is not an option
I will freely admit it – I’m an impulsive buyer. I get an idea into my head and it just cycles through the gears and synapses of my grey matter until I am finally forced to act upon said impulse. I’ve learned to temper and control these impulses recently but sometimes I can’t talk myself out of a purchase. My first car back in 99 was a Pathfinder. Oh how I LOVED that car. The memories I have of cruising around with my friends and the shenanigans we pulled will be something I treasure until the day I die (or I lose my memory, whichever happens first).
After about 5 years and 75,000 miles on the Pathfinder, it started to break down. First it was minor things but then suddenly I was in the shop on a monthly basis paying $500 each time. My transmission fell apart and I ended up shelling out close to $2200 if I remember correctly. The next month was $500 struts and shocks. My mechanic then commented that he’s never seen what happened to my shocks happen before. He also then informed me that it seems that it’s not just my Pathfinder breaking down. Everyone who has the same model/year of my car was experiencing the same problems. I just seemed to be the first and he could count on at least 5 more people bringing their car in. At that point I realized I could buy a new car and pay less a month than I was for the repairs. I got an ad in the mail for the Scions. I checked it out and the car was uncomfortably, ridiculously small. I ended up wedging my knee in between the steering and pedal. I seriously couldn’t move it at that point and I’m not even that tall. I’m average height. I ended up checking out the other cars and because they gave me a great deal, I ended up going with the Toyota Camry.
I will state for the record that I totally hated the car. While it was reliable, it had nothing desirable. It had no cool features, it had the same body style since 1992 (which my mom had) with a minor tweak here and there and a poorly designed interior. There was so much empty space and poor designing that it aggravated me every time I got into the car. Going from the Pathfinder to the Camry was a serious step down. I wanted the luxury edition of the Camry but I wanted the 4 cylinder as I was looking to save money gas. The gas prices at this time were hitting $4 a gallon and the hybrids weren’t so great for an option at the time. The dealer at that time told me that I can’t get the luxury package on the 4 cylinder as it was only available on the V-6 so I settled and purchased the 4 cylinder. I drove the car for a little over 5 years. It was reliable, but it didn’t excite me or particularly enthrall me in any way shape or form.
Recently I got it in my head that I should get a new car. It was one of those thoughts I cast aside as it was just not feasible with the apartment situation and the job and the commute I was doing. The thought would come back up periodically. I just wanted to drive something a little more exciting. I helped my friend move and drove his Infiniti to his place while he drove the truck. It was a totally different experience than my Camry or Pathfinder. The strangest part of the experience were the two or three cute women who waved at me and smiled as I drove past in his car – something that had never happened to me before in any car I’ve been in.
Fast forward a about a year and I moved back home. I did the commute to work again and it was horrible. The drives were over an hour and a half and with traffic up to 2. Then came the new job unexpectedly. It let me work from home and I went into the office only occasionally. Then out of the blue, the idea cycled back into my head. I ran it by mother because it was a large purchase and I wasn’t sure if I should do it. She surprised me with “Do it. You should be driving a better car than a Camry.” which totally surprised me. So I did research and looked at different brands. There was no major need for a new car since my current one ran fine so I wasn’t pressured to actually buy something right away.
I narrowed it down to these cars (in the order I wanted them originally):