Matt Crampton / Blog

Query an NTP server from Python - June 9th, 2014

I came across a need to query an NTP server to get the current time from a python script. There are some great python modules you can install which will take care of the heavy lifting (one great one is ntplib), but I wanted to be able to do these NTP queries without requiring the host to install 3rd...

Move Vim .swp files - May 19th, 2014

Vim has this annoying habit of creating .swp files in your current working directory when you're editing a file. I found a better way (inspired by this stackoverflow thread). To change this, create three new folders to house all your .swp files...

JS Error using X-Editable? - November 3rd, 2013

If you're trying to use X-Editable and getting a JS error similar to this... TypeError: $.fn.popover.defaults is undefined It may be because you're using Bootstrap 3 and using their CDN urls for including their JS and CSS. Their CDN currently only hosts their Bootstrap 2 code...

Managing WIFI connections using the Mac OSX terminal command line - October 15th, 2013

I'm a command line guy, if there's a way to do something via the terminal I'll always choose it over using a GUI interface. One thing I find myself doing alot is messing with my wireless settings on my Macbook Air. I spent some time tracking down how to do alot of this via the command line, if this...

Force VIM to stop overwriting your default buffer when pasting - September 25th, 2012

I use VIM all the time for development, one thing that always bugs me is when I yank a chunk of code into my default buffer, and then paste if over something else, VIM will take whatever was pasted over and overwrite my default buffer with it. So the next time I try to paste, it will paste the...

Fixing "Viewport argument value" error in webkit's console - September 16th, 2012

I've been doing a lot of web development for mobile devices lately, and while I've been using chrome's developer tools, I keep getting annoying error messages in the console like this... Viewport argument value "1;" for key "initial-scale" was truncated to its numeric prefix...

Copying a directory in linux while preserving permissions - September 11th, 2012

Continuing on with my attempts to blog code and command snippets that I've found useful, Here's a trick if you need to copy a directory recursively, but retain all the permissions set on the first one. I needed this to back up a web app tree that had custom permissions set through out that I didn't want to mess up...

Fixing position:fixed elements stuck in the middle of the page on iPhone Safari - September 10th, 2012

We ran into an annoying bug over at Gigwalk while building a mobile webapp running inside Phonegap. We have a toolbar at the top of all our pages which is set to position:fixed, but every once in a while it would get stuck in the middle of the page. We tried several different proposed solutions, but this one...

Iterating over a dict in a jinja template - September 9th, 2012

At the time of this posting, iterating over dictionaries inside a Jinja template is poorly documented, and it's something I end up doing alot. Here's how you do it, nice and simple...

© Matt Crampton