Deploying with rsync, setting desired file and directory permissions

I'm currently building a new site using a minimal flat file markdown-embracing CMS called Pico. Once nice thing about flat file systems, of course, is easy deployment. Just grab all your files, push them to any host and you're good to go.

I'm using Git only for keeping track of the codebase and don't want to add content files to the repository. However, it would be tedious to manually keep track of the files added, changed and removed, so I decided to let rsync take care of that.

I found this nice shell script on Codewall

I don't want to...

  • go to a store when I don't really need anything
  • check if I got a lighter, tobacco, papers & filters stuffing up my pockets upon leaving the house
  • waste money this useless when actually I'm about to try to live a bit more economically
  • wake up coughing
  • kiss stinking
  • sleep worse than necessary
  • have to go outside in any shitty weather, often alone

Let alone all the health impacts usually brought as scaring arguments. But kicking these points out of my life will just make it a whole lot better and easier, so it doesn't feel like I'm giving up something.

So I simply quit.

There you have it. You now may officially slap me if you catch me with a cigarette.

Tags: 

Dynamic Offset for jQuery One Page Nav

jQuery-One-Page-Nav is a nice script that enables you to scroll smoothly to anchors anywhere on a page while and while it does so it sets a current class for your currently active navigation item.

As this is often combined with a fixed or sticky navigation design there’s an option to set an offset to define how far scrolling takes you. With Responsive Webdesign your sticky element (header in my example) might have a different height depending on the viewport the page is being displayed on.

So I thought it’s a good idea to set this offset dynamically so I scrolling never takes me accidentally under my fixed header:

Tags: 

Loading Drupal SimpleAds' JavaScript with drupal_add_js

I'm working on a site that utilizes the Drupal module SimpleAds. In an effort to optimize front end performance I moved all my theme's Javascript to the Footer (by simply moving <?php print $scripts; ?> around in html.tpl.php). After doing that the ads disappeared and my browsers console telling me Uncaught ReferenceError: _simpelads_load is not defined.

The problem is that Simple Ads now tries to load some of its scripts before its dependencies because it wasn't injected properly using drupal_add_js. Moehac found a solution and thankfully posted it to the issue queue:

Copy simpleads_block.tpl.php to your theme and change

  <script type="text/javascript">
    _simpelads_load('.simpleads-<?php print $tid; ?><?php if ($prefix) : ?>-<?php print $prefix; ?><?php endif; ?>', <?php print $tid; ?>, <?php print check_plain($ads_limit); ?>);
  </script>

to

Tags: 

Top Reasons to Root your Android Device

Yesterday I finally rooted my new Nexus 5. Here are my first experiences about the advantages I liked best.

Rooting the Nexus 5 on Mac OS X

I didn't want to bother downloading the entire Android SDK so I looked around for a dead simple solution and found the Nexus 5 One Click Toolkit. It could hardly be easier. Just download One Click Root Toolkit for Nexus 5, unzip it and follow the instructions.

It comes packed with TWRP Recovery, which has the advantage of a touch interface in comparison to Clockworkmod Recovery.

Make your Drupal module's variables multilingual

If you're writing (or using) a module that stores information in Drupal's variable table there might be the need to change the values of your variables depending on the language your site is currently viewed in.

To do so you'll need i18n and its submodule Variable Translation enabled. To make a variable multilingual you typically head over to admin/config/regional/i18n/variable, check the desired variable and save your settings. But, what if your module's variable doesn't show up here? That means your module didn't implement hook_variable_info, provided by the Variable Module. Luckily it really is a piece of cake implementing it. Just create a file called yourmodule.variable.inc inside the module's root directory. You could also put it in the main module file, but having a separate file is the cleaner approach. The correctly named include file will be loaded automatically.

Tags: 

Hide Views Results until Exposed Filters are applied with Drupal 7

I've been fighting this for quite a while and tried different approaches over time, all of which somehow worked. From using Arguments with PHP validation to implementing hook_views_query_alter there are many options. Now I found out that the latest dev version of Better Exposed Filters (released 10/2013) integrated a patch that enables the desired behaviour. In your View enable Better Exposed Filters, go to BEF Settings and check Require input before results are shown. Much less painful than any other method I used before.

Setting Exposure and Focus independently with Android

In my previous post about the first Android apps I'm using on my new LG Nexus 5 I mentioned Camera FV-5 which allows to set focus and exposure separately but still didn't just feel very comfortable to me. Setting focus and exposure just didn't work really quick and sometimes I had to tap several times to get it working as desired. Also, the UI of Camera FV-5 is little too cluttered for my taste.

Back to Android: First Impressions

As my iPhone 4S became painfully slow after updating to iOS 7 I didn't want to pay another fortune to Apple just to get a modern OS running smoothly. Also, there are some things really annoying me more and more on iOS, some of the worst being not to have an option to set a default browser and email client and not having global sharing/send-to-app options for third party apps. Also, I really like using GMail a lot and the performance of the iOS app is just a major PITA.

So, I got myself a new Nexus 5 and here are my first impressions as well as a little overview of the apps I quite liked so far.

Camera

I didn't expect to buy a device that's able to compete with the iPhone camera wise, so my expectations weren't too high. Still, in low light conditions I'm a bit underwhelmed by the quality it produces (a lot of noise). Also, I still haven't found the perfect camera replacement app suited for my needs. I think I'll get used to it and fiddle my way around. As with most cameras when light conditions are good image quality seems satisfying.

Pages