Sunday, September 29, 2013

Convert 'date_added' field in Chrome Bookmarks file to readable format.

So I've been trying to figure out the format of the 'date_added' field in the Chrome Bookmarks file. e.g. 13024882639633631

After a lot of research, I learned that those numbers were actually the number of milliseconds since 1601-01-01 like the Windows NT Time format.

I asked a question on SO and a smart guy looked up the Chromium source and got the exact details.

Anyway, he posted a Python snippet which I edited a bit. You can have a look here: https://github.com/keithxm23/ChromeTimeToDate

Sunday, September 22, 2013

Buying GoDaddy Domains? Use Honey for great discounts!

So I use this Chrome addon called Honey that places a button on the checkout pages for all major online retailers like Amazon, Walmart, Ebay etc. also Godaddy, and on pressing the button, will apply 10-25 coupon codes from it's database and look for a discount for you.

I never found a discount for an item on Amazon yet but I recently purchased 4 domains from GoDaddy and saved a total of $45 already, getting most of the domains for less than $2 a year! Definitely get the add-on (or just look-up retailmenot.com for a coupon instead) whenever purchasing a GoDaddy domain since it looks like there almost always is a discount coupon out there.

More details about Honey here: http://joinhoney.com/

Wednesday, September 18, 2013

How to add images inside rows in jQgrid

This tutorial will go over how to add an image inside a jqGrid cell when the 'url' is delivered from your json data.
Your grid will look something like this:

1. Add the required title to the colModel.
2. At the appropriate position, add the colModel as follows:
{ name: "photo_mobile_url", formatter: playerPicFormatter},
where "photo_mobile_url" is the key of the image in your json data.
For e.g. my json data looks like..
{...
"photo_mobile_url": "http://cdn.ismfg.net/static/plfpl/img/shirts/photos/51507.jpg",
...}
3. After your jQGrid definition, add the function:
    function playerPicFormatter(cellvalue, options, rowObject) 
    {
      var html = "<img src='"+cellvalue+"'/>";
      return html;
    }
Here, cellValue will hold the value held at the key: photo_mobile_url and so you can edit it if you have to, to correctly display your image.
Make sure the function name is the same as in the formatter.

That's it!

Thursday, September 12, 2013

Setup Heroku app with GoDaddy Domain

This tutorial will take you over steps on how to point a GoDaddy domain to your Heroku app.

Let's say your Heroku app's url is mount-calm-1234.herokuapp.com and your GoDaddy domain that you want it identified with is mynewdomain.com

First go to your Heroku app and add the domain as follows:
heroku domains:add www,mynewdomain.com
heroku domains:add mynewdomain.com

Next,
Edit the DNS Zone File for your domain on GoDaddy's Domain Manager. Have the CNAME record for www point to mount-calm-1234.herokuapp.com

Finally, you need to forward the root/bare/naked address of mynewdomain.com to forward to www.mynewdomain.com

For this, under the Domain Manager, hit the 'Manage' button and 'Update Forwarding' and have it forwarded to www.mynewdomain.com with only forwarding. You can try masking too however this puts your target page in an iframe and as a result your favicon will not load.

You should be all set.

Wednesday, September 11, 2013

Integrating RefineryCMS 2.0 + Twitter-Bootstrap-Rails

This article is for integrating RefineryCMS 2.0 and Twitter-Bootstrap-Rails. Note that RefineryCMS in this tutorial is not the latest (which at the moment is 2.1.0).

At the end of the below steps, you should have a RefineryCMS app with a static Bootstrap layout.

After setting up your Rails app (basic steps here): , you need to override some of the views and so execute the following commands:
rake refinery:override view=refinery/_head
rake refinery:override view=refinery/_header
rake refinery:override view=refinery/_menu
rake refinery:override view=refinery/_content_page
rake refinery:override view=refinery/_site_bar
rake refinery:override view=refinery/pages/home
rake refinery:override view=refinery/pages/show

Then install the static template for twitter-bootstrap-rails
rails generate bootstrap:install static

Then replace the contents of each of the files listed in app/views/refinery/ with the following:
https://github.com/keithxm23/Portfolio/tree/boilerstart/app/views/refinery
From the link above, copy paste contents of all files in app/views/refinery including those in the /pages directory to the respective files in your project.

Also copy paste the contents of bootstrap_overrides to fix some of the css issues. This css-fix is a bit hacky and you can try to do a better job of it if you wish.
https://github.com/keithxm23/Portfolio/blob/boilerstart/app/assets/stylesheets/bootstrap_and_overrides.css

You should be golden. 

Popular Posts