Tell facebook to rescrape your web page

Like any page  preview system out there.. facebook cache’s the content of web sites. This is to improve the UX for the user sharing a page… faster service equals better service.

This is not so great though for the guys and girls who’s job it is to get great, rich and beautiful content on the sites and blogs we frequent during our daily time wasting rituals.

Much like Google’s webmaster tools however, Facebook have a page to wipe the cache of a given url..

https://developers.facebook.com/tools/debug/og/object/

Important note: Do not use protocol-less url’s for your og:image tags. Facebook cannot handle it yet.

 

 

Extending airport wifi times indefinitely

Ever been to an airport “lounge”? Ever been stuck in one for more than 30minutes?

Today I had the great fortune of enduring one for just over two hours, I was immediately filled with excitement. 120-140minutes surrounded by shops and bars I had no interest in coupled with music not really to my taste.. so what do you do, you run away to the digital world. Fire up the laptop to read some news or other only to be confronted with a 30 minutes freebie connection to the world wide web.

Having working in IT and dabbled in network restriction interfaces you quickly arrive at the decision that Airport WiFi recognises your device by MAC address, with the next thought being “how can i spoof it”?

Windows:

  1. Fire up a device manager and find your WiFi card under the “Network Adapters”. Right click and head to properties.
  2. Click the “Advanced” tab.
  3. Find the option (doesn’t exist for all WiFi cards, read on if this applies to you) in the list titled “Network Address” and select.
  4. On the rhs you should see a blank input box, simply enter a new mac address in this fields and click the radio button.
  5. That’s it, you WiFi will be broadcasting with a new MAC Address. You may need to restart your connection and clear browser cache to restart your connection and start a new timer.

Windows on some Intel chips;

1 – For some reason Intel decided to not allow the MAC address to change from that set at the factory. They claim it is to do with security, I am not so sure. Eitherway, if this is you head over to here: https://technitium.com/tmac/

Apple Mac

Mac OS X’s System Preferences pane displays each network interface’s MAC address, but doesn’t allow you to change it. You can do so with a single command but it is only a temporary solution that will reset on a machine reboot.

  1. Fire up a terminal and run:

    sudo ifconfig en0 xx:xx:xx:xx:xx:xx

    The network interface will generally be either en0 or en1, depending on whether you want to configure a Mac’s Wi-Fi or Ethernet interface. Run the ifconfig command to see a list of interfaces if you’re not sure of the appropriate network interface’s name.

You can verify your change took effect by running a command that shows your network connection details and checking what MAC address your network interface reports afterwards. On Windows, run the ipconfig /all command in a Command Prompt window. On Linux or Mac OS X, run the ifconfig command.

Creating Doctrine entities via YAML files

OK, so today I was tasked with putting together a quick Chat application with Symfony2 and Doctrine.. had been about a year since I was last really doing anything with Symfony2. After coming from the MEAN playground took me a few hours to get my head back into Symfony.

The first thing I needed to do after throwing together the templating system.. the database schema. Now last time I was in symfony I remember the wonderful joys (sarcasm) of editing entity php classes after they had been made so this time I went about it via a different route:

1 – create the yaml file (simplistic version):

2 – Now get doctrine to do all the donkey work:

That’s it. Done… all manageable from a nice tidy yaml file.

Running apache2 virtual host as specified user

MPM-ITK is fast. Much faster than SuPHP – since it uses the built-in apache module to run php scripts and not a cgi binary. In fact, on my dev box (a custom Intel Atom server) it went from 32 to 75 requests per second for a simple PHP script with ApacheBench (10 concurrent, 500 requests if you’re curious).

Installation:

Just drop in this into a vhost:

For example (near the bottom):

JS Regex return false or parts of a url

The other day I was writing a URL scraper and needed a function to return the parts of a given url. The function runs on the client and server.

Current known issue: doesn’t split out the hash from the path if there is only a hash alone without a get param

http://jsfiddle.net/6v1u5w1f/2/

Example use case:

A nice variant on the traditional poor UI picklists

Tasked with creating a simple pick list ui I had a look around the net for a prebuilt option… I mean, it’s a picklist right so it must be super common. Turns out not so much. After wasting half and hour faffing about fiddling with the prebuilt ones in an attempt to make them look and function half decent I gave up and knocked together a jQuery UI version in less time.

Working example on JS Bin

The html select which in my case was database driven and automatically printed from a CMS data type:

The custom CSS:

And last but not least the JS (NB this is fairly rough and ready):

 

Working example on JS Bin