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,...

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...

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>’;...

Wednesday, October 21, 2015

Gmail notification only for important mails

Some e-mails are more important than others. As a freelance writer/web designer/translator I often get time critical messages. I want to get an email notification with a sound alarm and a vibration for those, but not for all my mail (my phone would be abuzz continuously). So I found this useful article on how-to geek. It is free and really simple to set up in gmail. You basically add a filter label and set your notifications only for that label in Android (the label needs to be created on a pc though). Gmail notification is just a part of the puzzle for freelancers, especially those who want to be the first to respond to job offers. ...

Tuesday, October 20, 2015

Feel The Bern in a Theater near you

...

Wednesday, October 14, 2015

Light background (the best way)

When creating a fixed background image there are a few things to consider: browser compatibility. Does that z-index work everywhere? image size. Does this load fast enough on a 3G connection? ease of change. What happens when the theme updates? I found that the easiest way is to set the background-image property via the add-on CSS. That way it is “in between” the theme layer and the individual page. Adding an <IMG> is also possible straight from the content but it gives you z-index headaches. The content elements just don’t seem to go in front of the image element. So on creativechoice.org I just added this 12k file stretched as the background of site-content: .site-content { background-image: url("http://creativechoice.org/wp-content/uploads/2015/10/bkg.jpg"); background-size:...

Monday, May 18, 2015

LESS in 5 minutes

LESS is a handy precompiler for CSS, but as it develops it becomes so complex we start assuming that we need a tutorial or long read in order to understand it. I think it’s worthwhile to use just a few very basic capabilities of LESS (leaner CSS) and that you can learn how to use them in 5 minutes. First, on Windows you can use http://winless.org/ If you use WordPress, install Jetpack which comes with an extra CSS option allowing LESS (or use another plugin that has integrated the PHP LESS-compiler). No sweat so far. Take an old CSS file and replace color codes with variables like so: body { color : 77da34; } becomes @green : 77da34; body { color : @green; } Variables are the first thing we absolutely NEED if we want to write leaner CSS. The next is mixins: Instead of...

More.less

/* http://designshack.net/articles/css/10-less-css-examples-you-should-steal-for-your-projects/ */ @base: 663333; @complement1: spin(@base, 180); @complement2: darken(spin(@base, 180), 5%); @lighten1: lighten(@base, 15%); @lighten2: lighten(@base, 30%); @lighter1: lighten(spin(@base, 5), 10%); @lighter2: lighten(spin(@base, 10), 20%); @darker1: darken(spin(@base, -5), 10%); @darker2: darken(spin(@base, -10), 20%); .opacity (@opacity: 0.5) { -webkit-opacity: @opacity; -moz-opacity: @opacity; opacity: @opacity; } .border-radius (@radius: 5px) { -webkit-border-radius: @radius; -moz-border-radius: @radius; border-radius: @radius; } .box-shadow (@string: 2px 2px 4px rgb(0,0,0,0.5)) { -webkit-box-shadow: @string; -moz-box-shadow: @string; box-shadow: @string; } .drop-shadow...

Monday, May 11, 2015

Copying formula's in LibreOffice Writer

Here’s another little annoyance solved: I used LibreOffice to make simple invoices and use the nice calc function to calculate the items in my invoice. However. LO didn’t allow to copy formula’s – or so I thought. I found this after some searching and thought I’d share it with you. It is possible, as explained in the excellent libreoffice forum. ...

Tuesday, April 28, 2015

Sorting dates with PHP

This should have been much faster, so I’m sharing this. PHP (<5.2) creates and compares dates out of the box with the dateTime class. This is my use case. I had saved some dates as strings in the database, using the jQuery datepicker. I had to convert them back to dateTime-objects to compare two dates. The proper way to do this is to turn them into objects either by using date_create() or new dateTime(). Note that if you use a string that can’t be recognized, the constructer returns false, and your subsequent comparison functions screams at the boolean. Here’s that comparison function, and the usort-statement that uses it to sort an array of objects by date: function cmp($a, $b) { $datetime1 = date_create($a->meta_value); $datetime2 = date_create($b->meta_value); if ($datetime1...

Monday, April 27, 2015

WP_less

I’m a heavy user of LESS and I rejoiced when I learned that some geeks plugged in the LESS PHP-compiler into WordPress – and it works out of the box! I didn’t experience any issues with syntax (although you sound be careful as there are little difference between the LESS compilers) and the LESS files in my child theme were automatically compiled. Just go to https://wordpress.org/plugins/wp-less/ and get the integrated LESS compiler. Enqueue your LESS stylesheet like you would normally enqueue your .CSS. (you can change back to minified .CSS on a production environment, but with fast cashing, there’s not even a need for that. Here’s how I enqueue mine: if (class_exists('WPLessPlugin')) wp_register_style( 'custom', get_stylesheet_directory_uri()."/css/custom.less" ); else { wp_register_style(...

Sunday, April 26, 2015

Wordpress 4.2

I just updated a multilingual multisite to WordPress 4.2 – without opening my FTP-client, editing settings files, are even clicking away from the WP dashboard. It works just out of the box. Awesome! This is the first major WordPress release of 2015. There are some noticeable improvements. What do I think about them? Changing themes directly in the customizer – will save some time especially if you set up many sites like I do Better support for embeds – Tumblr is good and all, but I normally go the other way around, posting from my WP to tumblr (and I don’t want to embed other people’s blogs). Sharing youtube video’s is useful though Faster plugin update – Comes in handy, especially in an experimental environment where you try out many plugin’s latest versions Under the...

Saturday, April 25, 2015

Using masonry with Ajax reload

I  was struggling with masonry tonight. I know, it’s an old script and we should probably look out for something new, but still. I have this good ol’ website that uses ajax loading for search. It is triggered on the search (don’t forget e.preventDefault()) and will put what it finds in the inner element into the outer element. So far so good. But what happens is dat the jQuery-object on which the Masonry-instance is working is now obsolete (on my site it is called $container, which captures #container. So this is important: Always make sure that you are excuting masonry on the right DOM-objects. When I added the statement $container = $("#container") after the AJAX-call was done loading (.done), things worked. Also notice that I use imagesLoaded() to make sure masonry doesn’t start...

Thursday, April 23, 2015

Good Tutorial on background video

While browsing airbnb.com I noticed the amazing background video they have there. It’s concise, relevant to what their page is about, and distracts minimally from the Big Search Field. I looked into it for another project and it turns out, Airbnb does it by the book. Provide fallback .jpg image for mobile devices Provide .webm and .mp4 for different resolutions, and put the .mp4 after the webm. Control the layout of your <pre>HTML5 <video></pre> with css (or better: use LESS or SASS) Use video’s that are easy to loop and are not longer than 10-15 seconds Try crushing the file size as much as you can! Keeping it under 1MB is cool for the folks behind slower connections. Here is a very useful tutorial over at Demosthenes.info. ...

Monday, April 20, 2015

Flush Permalink Cache

I was working on some custom pagination functionality for WordPress, and after much too long I found out you <em>have to flush the permalink cache</em>. Just go to Settings > Permalinks and click on “save” without making any changes. That’s it. Check out WordPress’ great <pre>wp_rewrite</pre> class and endpoint functionality. ...

Saturday, January 24, 2015

Likely Cause of White Screen of Death in Wordpress

I looked at causes for the white screen of death in WordPress today. Of course, the first thing is to turn on WP_DEBUG in config.php. This could produce a lot of clutter as there are many plugins – and even parts of core – that use deprecated functions. But never mind. In my case, I was uploading a theme I am creating that uses some functionality (widgets) that I had originally put in a plugin. So now that code was double: Fatal error: Cannot redeclare ccb_load_widgets() (previously declared in Uh-oh. Facepalm. Redeclaring functions is a major cause of WordPress giving up with a white screen. Hope this is of any use to anyone. ...
Page 1 of 1412345Next

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