Tuesday, May 28, 2013

Cherry pickup (Brentwood, Gilroy)

Where:     Lopez Ranch
1801 Orchard Lane
PO BOX #807
Brentwood, CA 94513
(925) 634-4433

Where:     Laird Ranch
3150 Sellers Ave
Brentwood, CA 94513
(925) 998-5769

Where:     Heritage Family Farm
2500 Concord Ave.
Brentwood, CA 94513
(925) 642-7653

Where:     Bacchini's Fruit Tree
2010 Walnut Blvd.
Brentwood, CA 94513
(925) 634-3645

Where:     Bloomfield Cherries
501 Payne Ave.
1/2 mile west of Walnut
Brentwood, CA 94513
(925) 550-5540

Where:     Chavez U-Pick Cherries
South side of Marsh Creek Road between Walnut Blvd. and Sellers
, CA
(925) 625-3994

Where:     DC's Extraordinary Cherries
2012 Marsh Creek Road
1/4 Mile West of Highway 4 Bypass on Marsh Creek Road, One mile
Brentwood, CA 94513
(925) 516-4495

Where:     Maggiore Cherry Ranch
Camino Diablo Rd.
1/2 mile East of Vasco Road
Byron, CA 94514
(925) 634-4176

Where:     Maggiore Ranches
Camino Diablo Rd.
1/2 mile East of Vasco Road
Byron, CA 94514
(925) 634-4176

Where:     Mike's U-Pick
3230 Concord Ave.
Brentwood, CA 94513
(925) 698-7459

Where:     Nunn Better Farms
Sellers Avenue
Between Sunset Road and Chestnut StreetBrentwood, CA
Brentwood, CA
(925) 634-2148

Where:     Papini Family Orchards
301 Sellers Ave.
Brentwood, CA 94513
(925) 759-6735

Where:     Papini Farms #2
301 Sellers Ave.
Brentwood, CA 94513
(925) 759-6735

Where:     Pease Ranch
25175 Marsh Creek Road
Brentwood, CA 94513
(925) 634-4646

Where:     Pomeroy Farm
1600 Eureka Ave.
PO BOX #67
Brentwood, CA 94513

Where:     RC U-Pick Cherries
4401 Sellers Ave.
Brentwood, CA 94513
(925) 679-3011 

-------------------------------

Buckley u-Pick Cherry Farms
2950 Leavesley Rd
Gilroy, CA 95020
(408) 842-4697
http://www.buckleycherries.com

Lazy K Ranch Cherry U-pick
3465 Susie Ln
Gilroy, CA 95020
(408) 888-5431
http://www.gilroycherries.com/


Gizdich Farms, (Strawberry, apple U-pick)
55 Peckham Rd., Watsonville.
831/722-1056.

Tuesday, May 7, 2013

Load from local when CDN fails

<!--script>window.requirejs || document.write('<script src="js/lib/require/require.js?v=RELEASE_VERSION"><\/script>')</script-->

f (typeof requirejs === 'undefined') {
    document.write(unescape("%3Cscript src='js/lib/require/require.js?v=RELEASE_VERSION' type='text/javascript'%3E%3C/script%3E"));
}

RequireJS itself has fallback URLs support
requirejs.config({
    enforceDefine: true,
    paths: {
        jquery: [
            '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min',
            'js/lib/jquery/jquery-1.7.2.min'
        ]
    }
});

Monday, May 6, 2013

Spent 20 mins to figure out typo is root cause

Once in a while, we may have typo in our code, sometimes it might not cause issue if it is local variable name, sometime it does result in bug. Today I tried to add tooltip to one div using bootstrap tooltip javascript library, and it gave me the following error

Uncaught TypeError: Object #<Object> has no method 'addClass' bootstrap.js:1168
Tooltip.show bootstrap.js:1168
Tooltip.enter bootstrap.js:1097
e.extend.proxy.g jquery-min.js:2
f.each.f.event.special.(anonymous function).handle jquery-min.js:3
f.event.dispatch jquery-min.js:3
f.event.add.h.handle.i

The error message says there is no method addClass, but the problem is when I write the mockup
<span title="Here is the tooltip info" data-placement="bottom" rel="tooltip">Meet ID</span>, I typed bottome instead of bottom, and I could not find out why it didn't work till I debug.

If I have an IDE with typo check ability, it might save me time.

Sunday, May 5, 2013

Social buttons

Twitter
Twitter has 4 different buttons (share, follow, hashtag, mention)
https://twitter.com/buttons
https://twitter.com/about/resources/buttons

It is very easy to generate twitter button code to embed our website. From button website, select preferred button, and specify necessary options, then copy and paste the automatically generated twitter button source code.

Here is one example of tweet button
<a href="https://twitter.com/share" class="twitter-share-button" data-url="https://www.example.com/retweet.html">Tweet</a>
! function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0],
        p = /^http:/.test(d.location) ? 'http' : 'https';
    if (!d.getElementById(id)) {
        js = d.createElement(s);
        js.id = id;
        js.async = true;
        js.src = p + '://platform.twitter.com/widgets.js';
        fjs.parentNode.insertBefore(js, fjs);
    }
}(document, 'script', 'twitter-wjs');

Asynchronously load the button - by default, Twitter takes care of this. However, during my test, it seems not load in an async way, so I suggest to add js.async = true to above code.

https://dev.twitter.com/docs/tweet-button has details about adding buttons using Javascript, iframe or even build your own twitter buttons.

Bolt - twitter uses HTTP HEAD to crawl shared link, check out the discussion
https://dev.twitter.com/discussions/1722

Facebook
Facebook has Login, like, send, follow etc buttons.

Similar to twitter, facebook also provides a easy way to generate button codes on the fly. For details, check out https://developers.facebook.com/docs/plugins/

Take Facebook Like button as an example, https://developers.facebook.com/docs/reference/plugins/like/ has the UI to let developer get the social button code on the fly. Facebook Like button also provides 3 ways (HTML5, XFBML and iframe) to create button on website.

Here is one HTML5 example:
<div class="fb-like" data-href="https://www.example.com" data-send="false" data-layout="button_count" data-width="450" data-show-faces="true"></div>

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=yourappid";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Here is one iframe example:
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.example.com&amp;send=false&amp;layout=button_count&amp;width=80&amp;show_faces=true&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=yourappid" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true"></iframe>

Note width=80 is a trick to not show Like comment UI

Async loading? js.async = true
 
http://www.aaronpeters.nl/blog/why-loading-third-party-scripts-async-is-not-good-enough
Load (some of) those scripts after onload to increase the usefullness of your web performance data.

Bolt - facebook uses facebook bolt to crawl links (URLs) shared on facebook.

Update  5/12/2013
http://www.phpied.com/social-button-bffs/ has a summary of FB/Tweet/Google+ buttons

Social buttons' Markup
<!-- facebook like -->
<div class="fb-like" data-send="false" data-width="280"></div>
<!-- twitter -->
<a class="twitter-share-button" data-count="horizontal">Tweet</a>
<!-- g+ -->
<div class="g-plusone" data-size="medium"></div>

JS codes
<script>(function(d, s) {
  var js, fjs = d.getElementsByTagName(s)[0], load = function(url, id) {
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); js.src = url; js.id = id;
    fjs.parentNode.insertBefore(js, fjs);
  };
  load('//connect.facebook.net/en_US/all.js#xfbml=1', 'fbjssdk');
  load('https://apis.google.com/js/plusone.js', 'gplus1js');
  load('//platform.twitter.com/widgets.js', 'tweetjs');
}(document, 'script'));</script>

Load after onload event
http://www.aaronpeters.nl/blog/why-loading-third-party-scripts-async-is-not-good-enough
<script> (function(w, d, s) { function go(){ var js, fjs = d.getElementsByTagName(s)[0], load = function(url, id) { if (d.getElementById(id)) {return;} js = d.createElement(s); js.src = url; js.id = id; fjs.parentNode.insertBefore(js, fjs); }; load('//connect.facebook.net/en_US/all.js#appId=272697932759946&xfbml=1', 'fbjssdk'); load('https://apis.google.com/js/plusone.js', 'gplus1js'); load('//platform.twitter.com/widgets.js', 'tweetjs'); } if (w.addEventListener) { w.addEventListener("load", go, false); } else if (w.attachEvent) { w.attachEvent("onload",go); } }(window, document, 'script')); </script>