Skip to content

Instantly share code, notes, and snippets.

View shearichard's full-sized avatar

Richard Shea shearichard

View GitHub Profile
@shearichard
shearichard / OracleIdxStatsDump
Created May 28, 2012 02:51
Refresh Oracle Index Stats and output idx related info
set serveroutput on
set pages 0
set feedback off
set echo off
DECLARE
height index_stats.height%TYPE;
del_lf_rows_len index_stats.del_lf_rows_len%TYPE;
lf_rows_len index_stats.lf_rows_len%TYPE;
del_perc number;
table_name user_indexes.index_name%TYPE;
@shearichard
shearichard / index.html
Created November 16, 2012 03:15 — forked from punkish/index.html
D3 overlaying grid onto maps (forked from original - changed js src to CDN's)
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.5&sensor=false"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/openlayers/2.11/OpenLayers.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/2.10.0/d3.v2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
<style type="text/css">
#map, #viz {
position: absolute;
@shearichard
shearichard / jq_jqui_version_info
Created April 30, 2013 10:26
Get information about jQuery and jQuery UI versions in use
var jquiver4sheadbg = $.ui ? $.ui.version || "pre 1.6" : 'jQuery-UI not detected';
alert('jQ UI version : ' + jquiver4sheadbg);
var jqcorever4sheadbg = $().jquery;
alert('jQ version : ' + jqcorever4sheadbg);
@shearichard
shearichard / mixins_and_init_sharing.py
Created April 30, 2013 11:41
Demonstration of how mixins can be used to consolidate common __init__ functionality for classes that have differing superclasses
class SomeMixin(object):
def __init__(self, rel=None, attrs=None, *args, **kwargs):
print 'Testing sharing an __init__ via a mixin class'
self.someattr = "sm"
super(SomeMixin, self).__init__(*args, **kwargs)
class SomeSuper1(object):
def __init__(self, rel=None, attrs=None, *args, **kwargs):
print 'Testing sharing an __init__ via a super1 class'
class SomeSuper2(object):
def __init__(self, rel=None, attrs=None, *args, **kwargs):
@shearichard
shearichard / monthdelta.py
Created June 17, 2013 21:53
Move backwards and forwards in month long chunks of time
def monthdelta(date, delta):
'''
Acts like datetime.timedelta but deals with months
`date`: A datetime object representing the base date
`delta`: An integer representing the offset (-ve for going back in time)
Found at : http://stackoverflow.com/a/3425124/364088
'''
@shearichard
shearichard / index.html
Created November 5, 2013 10:03
Testing use of bl.ocks.org (temporarily borrowing code from http://bl.ocks.org/mbostock/1353700 to have something to work with but it's not my code)
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 500px;
position: relative;
}
@shearichard
shearichard / jsbin.umECosOf.css
Created November 21, 2013 09:45 — forked from anonymous/jsbin.umECosOf.css
Using jQuery to fiddle around with FieldSets in response to radio button selections
fieldset{
background-color:green;
font-family: sans-serif;
color: #123;
}
fieldset{
background-color:green;
font-family: sans-serif;
color: #123;
}
fieldset:nth-child(3){
background-color:red;
font-family: sans-serif;
color: #123;
}
@shearichard
shearichard / string-to-hex
Created April 13, 2014 23:57
Show Hex equivalent of string
print(":".join("{:02x}".format(ord(c)) for c in s))
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
img{
width: 80%;
margin: 0%;
padding: 0%;