12/16/14

Confused Shopper Chrome Extension

Next Cyber Monday will be a blast.

Confused Shopper is a Chrome extension that changes all of the prices on your page to appear to be between $0.01 and $0.99. Secretly upload it to a friend's computer and enjoy their reaction when they discover the great new deals of the day.




Lessons Learned:
  1. Calling the Javascript String replace() method with a function
  2. Regular Expressions for a repeating patterns
  3. Basic setup of a Chrome extension

Issues:
  1. Something like '$5 billion' would turn into something like '$0.45 billion', which looks silly.
  2. Since prices are randomly generated, if a page displays the price of a single item twice the two values may be different.


Fixes/additional features to add:
  1. Include conditions for the words 'billion, million, hundred' etc. and change accordingly.
  2. Keep equal prices equal (i.e. $10 and $10 will equal $0.22 and $0.22). 
  3. Let users choose the range of prices they want to display.
  4. Add functionality for turning the extension off
  5. Including a safeguard to keep people from actually buying anything when they are under the assumption that it costs less.




12/15/14

Keeping Heroku Apps Awake

I host my rails apps on Heroku, which is an awesome service.
It was becoming a problem though, that after an hour of disuse the apps would go into idle mode. When an app is idling, the time to start it up again ranges from 8 - 15 seconds, at which point many users would just give up and click elsewhere.

I fixed this by installing a Heroku add-on called Scheduler. This add-on makes it possible to carry out tasks periodically. I then wrote a rake command that sent a GET request to all of my apps, keeping them from idling.

Lessons Learned:

  1. Difference between web and worker dynos
  2. Building custom rake tasks
  3. Heroku add-ons




12/11/14

Code Academy: Make an Interactive Website

I had a feeling that I haven't been jQuery to its fullest potential!
This tutorial outlined some of the cool jQuery functions that can make interacting with Javascript so much easier.



Lessons Learned:
1. jQuery animate function
2. jQuery toggle function
3. jQuery event handlers











12/10/14

Jasmine Testing Framework

Vectors have proven to be useful wherever circles are involved, so I wrote myself a library to avoid rewriting code for every project. It includes functions for adding, subtracting, scaling and normalizing vectors. You can find the source code HERE.

I used Jasmine to test my functions. Click HERE to see my specs.
Click HERE to see the Jasmine Spec Runner in action. 

Got Jasmine set up thanks to THIS well-written tutorial.
Get the latest Jasmine version HERE.

Lessons Learned:
1. Basics of the Jasmine testing framework
2. Re-learned how to find the dot product of two vectors. Yaay!

Next Steps:
1. Use the Jasmine beforeEach, afterEach functions
2. Test asynchronous data 

12/8/14

Ring Game

Visit game HERE
See Github HERE

Lessons Learned:
1. Google analytics tracking
2. Custom shapes with KineticJS

Problems with program:
1.When the mouse is moved quickly past the rings, the program doesn't register that it had intersected with it. This makes cheating very easy.
2. Since each level is randomly generated, it is possible for a level to be impossible.
3. When the screen size is small enough, the Next Level button can be made to be right next to the star which, again, makes cheating possible.

Problem Fixes:
1. Register the mouse movement as a line instead of a point and check if the line intersects with the ring.
2. Set up safeguards regulating how close rings can be to one another.
3. Enable the size of the star, the player, and the radiuses of the rings to take into account the screen size.