Pages

Wednesday, December 30, 2015

Meteor

I played around with meteor yesterday and I have mixed feelings. First of all, I was impressed that the whole plaform (it is not just a framework but an end-to-end development platform for all devices and browsers that matter because of the power of JavaScript). It worked out of the box on my Windows machine and it deployed out of the box to the site (http://happy2016.meteor.com/).

I watched some videos about meteor and I like their bottom line of bringing to the world what Facebook and Google have been hiding from us for their revenue. Fast interactive (reactive) web technologies.

There are a few things that make me skeptical as to whether meteor is the future. First of all, do we really want to code in Javascript? I have found debugging a minor application to be a nightmare, even with Chrome developer tools. Hot code pushing and “optimistic UI” may be neat, but it really isn’t all that elegant or robust. I like the integration of angular and node, but I’m not sure about MongoDB. I needed a random record (my bad, I’m still thinking in SQL-records with primary and secundary keys rather than in document collections) and it was pretty tricky (but of course Stackoverflow helped me out).

I normally pick a platform for its clout and the amount of contributed modules/plugins. That’s why I used Drupal back in 2011 and switched to WordPress more recently. PHP, I know.

On Atmosphere.js there are some good projects available, but many are buggy and better not used in a production environment. Eventually, the success of meteor and similar platforms will hinge on how easy it is to deploy an app.

Tuesday, December 22, 2015

jQuery UI style hack

Some of us still use jQuery UI :) In fact, it wasn’t too bad, is still supported by all modern browsers, and performs reasonably well on mobile.

There is one issue: the graphics look horribly 2010. jQuery UI offers a user interface to cherrypick your own CSS (it’s great and kind of works: look at their themeroller here.

Still, it doesn’t let you replace the .png icons with font icons (fontawesome, dashicons). I didn’t feel like overhauling the thing so I came up with a simple hack that works for me (on this site):

.ui-corner-all { border-radius:0!important}
.ui-state-hover {border:0!important;background:transparent!important}
.ui-widget-header {background:@color1!important; color:@bkg!important}
.ui-widget-content{font-family:@font3!important}
.ui-state-default, ui-state-default:hover {color: @color1!important;background:@bkg!important;border:0!important}
.ui-corner-all thead, .ui-corner-all td {color: @color1!important;}
.ui-datepicker-prev span, .ui-datepicker-next span {visibility:hidden!important}
.ui-datepicker-prev:before, .ui-datepicker-next:before {font: 2em/1 dashicons!important;color: @bkg!important;}
.ui-datepicker-prev:before { content: "\f141"!important;}
.ui-datepicker-next:before{content: "\f139"!important;}

Sunday, December 20, 2015

Bob the Builder likes women with brick tits.

Tuesday, December 8, 2015

Weekly changing random number

Simple task: How do we generate a random number that automatically changes every certain period of time. Of course, we use the week number when calculating the random number. Also, we have to cache a “large integer” that will not change until the end of the week to get a deterministic random-enough number.

The result can look something like this when we integrate it in a WordPress menu and we only take into account the tags with a minimum number of posts.

$the_tags = get_tags();
foreach ($the_tags as $t) {
if ($t->count>INFOCUS_MIN) $ft[] = $t;
}
$tag = $ft[abs(SOME_LARGE_INTEGER * date(“W”) % sizeof($ft))];
$link = get_tag_link($tag->term_id);
$infocus = ‘<li id=”menu-item-featured-tag” class=”menu-item”><a href=”‘.$link.'”>’ . __(‘In focus: ‘)
. $tag->name.'</a></li>’;

This might be useful and hooking this simple stuff into a menu doesn’t really justify a plugin. But it can be extended with other functionality. We can call it Magic Menu Items. It could integrate with Jetpack to access statistics, and so on.

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Lady Gaga, Salman Khan