Skip to content

Instantly share code, notes, and snippets.

View leighghunt's full-sized avatar

Leigh Hunt leighghunt

View GitHub Profile
@leighghunt
leighghunt / gist:2962839
Created June 20, 2012 23:13
C#: ESRI: Layer initialisation/failure logging log4net
private void Layer_InitializationFailed(object sender, EventArgs e)
{
if (sender is ESRI.ArcGIS.Client.Local.ArcGISLocalDynamicMapServiceLayer)
{
_log.ErrorFormat("Layer_InitializationFailed - FeatureLayer ID: {0}, URL: {1}", ((ESRI.ArcGIS.Client.FeatureLayer)sender).ID, ((ESRI.ArcGIS.Client.FeatureLayer)sender).Url);
}
else
{
if (sender is ESRI.ArcGIS.Client.Local.ArcGISLocalFeatureLayer)
{
@leighghunt
leighghunt / gist:2962847
Created June 20, 2012 23:15
C#: logging log4net log4NetConfigFile
// Add reference to System.Configuration
using System.Configuration;
private void Application_Startup(object sender, StartupEventArgs e)
{
log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(System.Configuration.ConfigurationManager.AppSettings["log4NetConfigFile"]));
log4net.LogManager.GetLogger(typeof(App)).InfoFormat("Application_Startup()");
}
@leighghunt
leighghunt / gist:2962851
Created June 20, 2012 23:16
C#: logging log4net config log4NetConfigFile
<add key="log4NetConfigFile" value="log4net.config"/>
@leighghunt
leighghunt / gist:2962854
Created June 20, 2012 23:17
C#: log4net logging create _log member
private log4net.ILog _log = log4net.LogManager.GetLogger(typeof(<classname>));
@leighghunt
leighghunt / .gitignore
Created June 20, 2012 23:25
C#: GIT: VisualStudio DotNet .gitignore file ignore
obj/
bin/
ClientBin/
*.bak
logs/
Error_Log/
App_Data/
*.suo
*.csproj.user
@leighghunt
leighghunt / gist:3057261
Created July 6, 2012 00:13
JavaScript: JQuery: Includes
<script language="JavaScript" src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js' type="text/javascript"></script>
<script language="JavaScript" src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' type="text/javascript"></script>
<!---PrintMapAction.do?img=no:-->
<!--
TODO:
=====
Side by side operation with checkbox or argument
Formatting/placement of images
Loose hardcoding of image sizes
Test with larger number of layers
Get JavaScript added to server side code so added on fly.
-->
@leighghunt
leighghunt / gist:5762743
Created June 12, 2013 03:59
NodeJS Cheat sheet
Node cheat sheet
sudo add-apt-repository ppa:richarvey/nodejs
sudo apt-get update
sudo apt-get install nodejs
sudo npm install express -g
sudo npm install stylus -g
sudo npm install jade -g
@leighghunt
leighghunt / gist:9542123
Created March 14, 2014 04:24
Strip out ignored differences between DB scripts
Find:
Script Date: 03/14/2014 \d{2}:\d{2}:\d{2}
Replace:
<empty string>
Find:
USE \[\b(_\w+|[\w-[0-9_]]\w*)\b\]
Replace with:
USE [<DB NAME>]
@leighghunt
leighghunt / gist:9613116
Created March 18, 2014 03:35
Copying using pscp/putty
pscp -i "C:\Users\lhunt\Google Drive\Venari\keys\pcoc-leasing.ppk" C:\Users\lhunt\Downloads\shapefile.zip ubuntu@ec2-54-206-22-19.ap-southeast-2.compute.amazonaws.com:/home/ubuntu/downloads/