How to Deploy Your Repo to a Server Via Pipelines and SSH

March 9th, 2017

There is more to this post but for now. This is a very useful link on how to get SSH working with BitBucket Pipelines.

I have some repos that need to deploy to multiple servers etc…

Make sure to expand the ‘Use multiple SSH keys in your pipeline’ section.

https://confluence.atlassian.com/bitbucket/access-remote-hosts-via-ssh-847452940.html#UseSSHkeysinBitbucketPipelines-update_host

Supporting extFAT and rsync to an exFAT partition in Linux

January 12th, 2015

Ok this was a fairly annoying. exFat isn’t supported in Linux by default. But no fear it can be supported by installing exfat-utils and exfat-fuse packages from the official repos:

http://askubuntu.com/questions/370398/how-to-get-a-drive-formatted-with-exfat-working

Sweet, ok so now rsync should surely work right? Nope, not well anyway. Here’s why:

http://blog.marcelotmelo.com/linux/ubuntu/rsync-to-an-exfat-partition/

The above post explains it perfectly but the main problem is that the Linux exFAT does not cope well with the switches, particularly archive -a and spits out loads of chmod permission errors, but you can fix this by running rsync as follows:

rsync -rltDv [SRC] [DESTINATION]

Epic!

Sort an Object Array in PHP

September 17th, 2014

This gives me a brain ache every time and I always forget what project I used it in last so here it is. Still don’t quite understand why php cant just have a built in more readable function.


//$adverts is our object array

usort($adverts, function($a, $b)
{
    return ($a->price < $b->price);
});

Amazon SES and PHPList SMTP Send as Root Issue

July 8th, 2014

This is actually quite easy to do but there is one major problem if you are using WHM/cPanel.

You need to make sure you have this option set to off in Home » Server Configuration » Tweak Settings – Mail (Tab)

Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)

With this on it breaks your outgoing SMTP user so Amazon SES thinks you are not sending from a verified sender.

For more info on setting this up see here: http://www.silvatechsolutions.com/tech-tips/phplist-amazon-ses-perfect-together/

Bootstrap 3 Destroys Default Andorid Browser Video Controls

May 28th, 2014

Well despite every single link I could find on Google saying this is now fixed in Bootstrap 3 it really isn’t!

So here is the offending code on line 1669 of bootstrap.css v3.1.1!

input[type="range"] {
  display: block;
  width: 100%;
}

Basically the video position scrubber bar was just 0px in width causing all buttons to be bunched together and a new volume slider to appear…. pretty damn random!! I hate Android and video by the way, thought I would just get that out there.

Now no matter what combination of display I tried I could not override this setting. The only way to fix this was by editing the core css file and removing display: block; completely.

Am I the only one who tested video in the default Android browser when using Bootstrap 3? Evidently so according to Google… Man what a waste of 3 hours of trial and error!

Twitter Typeahead Search Suggest

November 14th, 2013

This is now the replacement for Bootstrap 2’s typeahead as it is no longer in the docs for Bootstrap 3.

https://github.com/twitter/typeahead.js/

I admit this is better cleaner version but my god the docs are not good! So confusing and took me a while to work it out. Classic case of geeks expecting you to know what they know. Here are some helpful tips.

First things first, I don’t know why they never show an example of ‘on selected do this’ event. That’s the main reason for typehead, you want to redirect to a page mostly upon selecting the suggestion… Anyway after lots of searching found an example. Yay..

https://github.com/twitter/typeahead.js/issues/300

Secondly I always use remote dataset but struggled to find an example dataset. In a nut shell this can be a json object like so where value is the default field typehead uses to search with.

//jquery 
$('#user-search').typeahead({
  name: 'ad_users',
  valueKey: 'name', //this is the field in your data set that typehead searches, if not defined default is 'value'
  limit: 10,
  remote: 'MY_URL/ajax/searchuser/q/%QUERY' //%QUERY is automatically replaced with whatever you type in the search field
});

//bind on selected do this
//datum is the json object and username is my field I want to return, in my case I also wanted to return the result in lowercase             
$('#user-search').bind('typeahead:selected', function(obj, datum, name) {
  document.location = 'MY_URL/staff/adcompare/ad-id/'+ datum.username.toLowerCase();
});

Here is an example of my remote data set.

[
  {"name":"Cabrinha (Pryde Group)","username":"Cabrinha"},
  {"name":"Class Clendar","username":"Classcalendar"},
  {"name":"Carafino","username":"Carafino"},{"name":"Calibro9","username":"Calibro9"}
]

Seems so simple but took me ages to get this right as serious lack of examples in the docs 🙁

Floating Table Headers

November 14th, 2013

Man where were all these great plugins 5 years ago! This is another brilliant super easy to set up jQuery masterpiece that allows your table header to float at the top of the screen when scrolling through large tables.

http://mkoryak.github.io/floatThead/

Perfect Retina Icons for Twitter Bootstrap

November 9th, 2013

Twitter Bootstrap is great but the icons are lacking a bit. Here is a great way to get perfect icons across all devices.

http://fontawesome.io/

Best jQuery Charts Plugin

November 9th, 2013

Here is an epic plugin for charts that looks great and easy to set up!

http://www.oesmith.co.uk/morris.js/

jQuery Table Sorter

November 9th, 2013

I’ve always wanted to have this option in my projects but never knew about this amazing plugin that does it all for you.

http://tablesorter.com/docs/