Skip to content

Instantly share code, notes, and snippets.

View davidwaterston's full-sized avatar

David Waterston davidwaterston

View GitHub Profile
@davidwaterston
davidwaterston / Geolocating IP Addresses for free using geoPlugin.net and ColdFusion
Created July 8, 2012 00:05
A ColdFusion function to grab geolocation details for an IP address using the free geoPlugin.net service.
<cfcomponent name="geoPlugin" output="no">
<cffunction name="ipLocation" access="remote" returntype="struct" displayname="ipLocation" output="no">
<!---
This function takes an IP address and passes it to http://www.geoplugin.net, a free GeoLocation service that
returns info about where that IP address is located i.e. city, country, etc. The returned data from geoPlugin
is cleaned up and returned as a ColdFusion structure.
Where the IP address is not passed in then geoPlugin.net will use the IP of the calling page. The IP used is
always returned in the 'geoplugin.request' variable.
@davidwaterston
davidwaterston / gist:3755420
Created September 20, 2012 11:39
Oracle: Check if a column exists in a table
select column_name as found
from user_tab_cols
where table_name = '__TABLE_NAME__'
and column_name = '__COLUMN_NAME__'
@davidwaterston
davidwaterston / keybase.md
Last active November 10, 2019 10:40
My Keybase proof

Keybase proof

I hereby claim:

  • I am davidwaterston on github.
  • I am davidwaterston (https://keybase.io/davidwaterston) on keybase.
  • I have a public key ASCOyyRe-PvHjGxtrNHIyjmtcwa-BTORNuLnis12meiufAo

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1G1XEEcyDTpB9xTsH7AW9p8duUhDEXb33 https://explorer.blockstack.org/address/1G1XEEcyDTpB9xTsH7AW9p8duUhDEXb33
@davidwaterston
davidwaterston / cuidgen.xml
Last active June 10, 2017 12:27
Test of storing a draw.io diagram in Gist to see if it can be shared publicly using the raw URL.
<?xml version="1.0" encoding="UTF-8"?>
<mxfile userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" version="6.7.8" editor="www.draw.io" type="google"><diagram id="c90c8005-b0ba-652e-bdff-c7c083828973" name="Page-1">5Vptd6I4FP41fiwHCG9+rFo7e8687bhzOvvJgxAx20hYCNX2128SEgWCitbudM70g8JNuMBzn9z75NoBGK+393mYrT6RGOKBbcbbAZgMbHsIfPbJDc+VwR0GlSHJUVyZrL1hhl6gNJrSWqIYFo2JlBBMUdY0RiRNYUQbtjDPyaY5bUlw865ZmEDNMItCrFsfUExX0mp5w/3AB4iSlbx1YHvVwCKMHpOclKm838AGS/FXDa9D5Uu+aLEKY7KpmcDdAIxzQmh1tN6OIebQKtiq66YHRuVzP4W4lG9yt6UwT0OsnjuHKe3jydY8TeATxCSDuXxy+qzQisNiBfl15gCMVnSN2aHFDtnLZXzKeptwlhjhpgBGWTAPYLREGI8JJrlwASb2BEwAs7OZMWLPqMZSkkI+naRU0sQK2HmIUZKyk4hNFf5wuID4KykQRaQx8ARzilhkP7YmLAilZF2bcCtdUpIxq46XwpZNh9uaSeJ3D8ka0vyZTVGrYChBlIvAU+ze7CnluJVpVSOTBySRJYmTned9vNiBDJk4/c5A/bL4hy8F2xRQVJfeI/qhXDDbN5iRyitG6WM1uKKUL6db7tSeJoiuyoURMUzsaRw+oXgTMgQLytCypxFbkAlMKxeKI27t9SV9aqxQ0UdrsdjqxOiG/GSkxIuNdiusRh+5xsBI3Oy2yKqkwPkYqpMl2nKSjuTzTJqvH8WpZSCWT5YojWG+w4GG
@davidwaterston
davidwaterston / toISOString
Created January 13, 2013 09:16
Javascript: converts a Date object into an ISO 8601 formatted string.
if (typeof Date.prototype.toISOString !== 'function') {
(function () {
'use strict';
// Function which takes a 1 or 2-digit number and returns it as a two-character string,
// padded with an extra leading zero, if necessary.
function pad(number) {
var r = String(number);
@davidwaterston
davidwaterston / gist:4191070
Created December 2, 2012 21:05
Javascript: Case-sensitive 'contains'
if (typeof String.prototype.contains != 'function') {
String.prototype.contains = function(str) {
return this.indexOf(str) >= 0;
};
}
@davidwaterston
davidwaterston / startsWith
Last active October 13, 2015 11:47
Javascript: Case-sensitive 'starts with'
if (typeof String.prototype.startsWith != 'function') {
String.prototype.startsWith = function(str) {
return (this.lastIndexOf(str, 0) === 0);
};
}
@davidwaterston
davidwaterston / gist:3927588
Created October 21, 2012 16:54
jQuery: Add 'maxlength' support to textarea fields. Validates cleanly in JSLint.
(function ($) {
'use strict';
$.textareaMaxlength = function () {
// Allows the 'maxlength' attribute to be used with textarea fields to limit the
// number of characters that can be entered.
// e.g <textarea id="myfield" maxlength="250"></textarea>
@davidwaterston
davidwaterston / gist:3902518
Created October 16, 2012 22:38
Git: Delete a remote tag
git tag -d abcde
git push origin :refs/tags/abcde