Skip to content

Instantly share code, notes, and snippets.

View tempredirect's full-sized avatar

Gareth Davis tempredirect

View GitHub Profile
@tempredirect
tempredirect / lse_stock_symbols.rb
Created January 15, 2011 23:55
scrap all the symbols and prices from the LSE website
require 'rubygems'
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open('http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/prices-search/stock-prices-search.html'))
while(true)
doc.css('table.table_dati tbody tr').each do |row|
cells = row.css('td')
@tempredirect
tempredirect / jquery.tooltip-remove.js
Created March 4, 2011 14:52
Hacky plugin to allow removal of the tooltips created by jquery tools tooltip
/**
* hacky plugin to allow removal of the jquery tools tooltip objects.
*
* Doesn't pay any attention to the special event configuration, and will blindly unbind all
* mouse[enter|leave] listeners from the trigger element.
*/
(function($){
var tooltip = $.fn.tooltip,
slice = Array.prototype.slice;
from google.appengine.ext import db
import datetime
import time
SIMPLE_TYPES = (int, long, float, bool, dict, basestring, list)
# taken from http://stackoverflow.com/questions/1531501/json-serialization-of-google-app-engine-models/1532035#1532035
class DictModel(db.Model):
def to_dict(self):
output = {}
@tempredirect
tempredirect / app-servlet.xml
Created March 14, 2011 22:35
ever wondered what <mvc:mvc:annotation-driven/> actually generates
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
@tempredirect
tempredirect / bitmapregion.py
Created March 17, 2011 16:04
functions to grab the regions in a bitmap like structure
from collections import deque
try:
set()
except:
from sets import Set as set
package {
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.external.ExternalInterface;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
@tempredirect
tempredirect / PostfixMessageCodeResolver.java
Created July 20, 2012 13:42
Solution for SO 11577363 - How do I customise the resource key lookup for spring MVC validation messages
package com.yourapplication.web.support;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.validation.DefaultMessageCodesResolver;
import java.util.ArrayList;
import java.util.List;
$ jruby -Xcompile.invokedynamic=true test.rb
Rehearsal -----------------------------------------------------------
with Proc 25.510000 0.280000 25.790000 ( 23.952000)
class Compare 14.490000 0.070000 14.560000 ( 14.395000)
class DelegatingCompare 16.890000 0.080000 16.970000 ( 16.300000)
------------------------------------------------- total: 57.320000sec
user system total real
with Proc 19.120000 0.100000 19.220000 ( 19.305000)
class Compare 14.430000 0.070000 14.500000 ( 14.215000)
@tempredirect
tempredirect / console.txt
Created December 24, 2012 09:34
output from gid79/GradleCheck
─[✗]─[gareth@MacBookPro-1]─[~/Projects/GradleCheck]─[master]
└──╼$ ./gradlew build
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:assemble
:beforeTest
**** - BEFORE THE TEST TASK
:test
@tempredirect
tempredirect / gist:5748491
Created June 10, 2013 12:56
stuff for thom
Using zookeeper (0.0.3) at path: '/Users/gadavis/Projects/cookbooks/zookeeper'
Installing core (0.0.0) from git: 'git@github.com:ExpediaInc/ean-core-cookbook.git' with branch: 'master' at ref: 'a053c30b760a3c1b36e05bfe35c7fc341218ce36'
Using upstart (0.0.1) at path
Using yum (2.2.0) at path
Using ohai (1.1.8) at path
Using ldap-mirror (0.0.1) at path
Using s3_file (1.0.0) at path
Using users (1.3.1) at path
Using route53 (0.0.3) at path
Using fog (0.0.2) at path