Skip to content

Instantly share code, notes, and snippets.

@andrewmcdonough
andrewmcdonough / swind
Created March 31, 2009 16:02
A bash script to move the focused window in X to different parts of the screen. Most useful when you assign shortcut keys to the various options, e.g. assign '<Super>Up' to run 'swind up'
#!/bin/bash
# Written by Andrew McDonough
# Prerequisites: xdotool must be installed and in your path (http://tinyurl.com/xdotool)
# A simple bash script that uses xdotool to move the window that is currently in focus to different parts of the screen.
# Particularly useful for reading web pages with flexible layouts on wide monitors.
# Assign the various options to keyboard shortcuts e.g. '<Super>Left' assigned to 'swind left'
# See http://tinyurl.com/ubuntukeys for help with assigning keyboard shortcuts.
@andrewmcdonough
andrewmcdonough / Finding performance problems using awk
Created December 8, 2009 12:19
Finding performance problems
gunzip -c production.log.1.gz |awk '/MyController#create/ {freq[substr($7,0,5)]++} END {for (time in freq) printf "%d\t%s\n", freq[time], time }' | sort -nr | head -n 5
# tail -f log/development.log
logger.debug("\e[H\e[2JThis log message will appear on a cleared screen")
# Add these two lines to your .vimrc to get shortcuts h1 and h2 to create markdown headers with a nice length.
# Works by coping and pasting the current line, then substituting any character with a = (for h1) or - (for h2)
:map h1 yyp:s/./=/g<ENTER>
:map h2 yyp:s/./-/g<ENTER>
Sys Admin and Application Development for sportcentric
======================================================
sportcentric is the market-leader in the provision of websites and online applications and databases to the international sports industry.
The company has its headquarters in Notting Hill, London and an office in Lausanne, and its client base includes Olympic, international
and national associations and governing bodies, professional sports franchises, and sports businesses.
sportcentric is looking for a new Technical Support person. We are looking for a technical person who enjoys client interaction.
<...existing universal settings...>
case `uname` in
'Darwin')
# Mac specific settings
<...put Mac specific settings in here...>
# End Mac specific settings
;;
Front-end developer
===================
Tribesports are in the process of building tribesports.com, a next generation
sports social network where people can share, celebrate and improve their
sporting performance. We are just about to enter our second phase of
development, and we are looking for a talented front-end web developer to join
the team. Our platform is built in Ruby on Rails, and although ruby experience
is highly desirable, we will consider candidates with strong front-end
development skills and experience in other languages, who are keen to work with
ruby. A passion for standards-compliant, semantic HTML and CSS is absolutely
@andrewmcdonough
andrewmcdonough / gist:1428231
Created December 3, 2011 21:39
Spotify apps api tips
Firstly, I was having problems accessing port 3000 on localhost, so I switched to pow,
so I could access http://spotview.dev (http://pow.cx/)
Secondly, the manifest.json file is only reloaded when you close and reopen the app,
so when you add your http://myapp.dev to the RequiredPermissions array, make sure you
close and reopen.
Finally, you need to set a response header of Access-Control-Allow-Origin: *. I did this
in rails with a filter in the controller, but you could do this more cleanly with rack
or a custom responder. My (slightly dirty) solution:
@andrewmcdonough
andrewmcdonough / gist:1892666
Created February 23, 2012 12:43
Nifty trick with bundler and rvm. In your app directory:
$ echo "export PATH=.bundle/bin:$PATH" >> .rvmrc
$ bundle install --binstubs=.bundle/bin
$ cd ..
$ cd <app-dir>
installs binstubs into app_dir/bin, and rvm adds ./bin to your path automatically (and takes it away again when you cd out of the app dir)
no more bundle exec
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<TrainingCenterDatabase xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd">
<Activities>
<Activity Sport="Running">
<Id>2012-03-18T12:41:04Z</Id>
<Lap StartTime="2012-03-18T12:41:04Z">
<TotalTimeSeconds>313.8300000</TotalTimeSeconds>
<DistanceMeters>1000.0000000</DistanceMeters>
<MaximumSpeed>4.0276432</MaximumSpeed>