Skip to content

Instantly share code, notes, and snippets.

View Dillie-O's full-sized avatar

Sean Patterson Dillie-O

View GitHub Profile
@Dillie-O
Dillie-O / gist:2432032
Created April 20, 2012 21:33
Simple Alert
alert('Woot!');
@Dillie-O
Dillie-O / gist:2480125
Created April 24, 2012 14:32
Amazon S3 Download File with Prompt
public static void DownloadObject(string keyName)
{
string[] keySplit = keyName.Split('/');
string fileName = keySplit[keySplit.Length - 1];
string dest = Path.Combine(HttpRuntime.CodegenDir, fileName);
using (client = Amazon.AWSClientFactory.CreateAmazonS3Client())
{
GetObjectRequest request = new GetObjectRequest().WithBucketName(bucketName).WithKey(keyName);
@Dillie-O
Dillie-O / gist:3361254
Created August 15, 2012 16:06
D3 Demo using jquery-svgpan
This file has been truncated, but you can view the full file.
<!DOCTYPE HTML>
<html>
<head>
<!-- jQuery -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!-- d3 -->
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js?2.9.5"></script>
@Dillie-O
Dillie-O / gist:3699824
Created September 11, 2012 16:58
Advanced Duplicate Row Query in SQL
SELECT COUNT(*) as duplicate_count,
application_id,
lock_version,
asset_id,
customer_id,
received_date,
fee_amount,
created_at,
updated_at
FROM application_versions
@Dillie-O
Dillie-O / gist:3700029
Created September 11, 2012 17:28
Advanced Remove Duplicate Row Query in SQL
-- Algorithm --
-- 1. Run query to get all duplicate count values. Since we're getting cloned
-- rows, we can run the query based off of all fields in the table. Store
-- in table variable.
--
-- 2. Iterate through table.
--
-- 2a. Use DELETE TOP(x - 1) remove all duplicates.
--
-- 3. Done
@Dillie-O
Dillie-O / gist:4162784
Created November 28, 2012 17:41
Pre-Build Event to check Provider Manifest Token
findstr /c:"ProviderManifestToken=\"2005\"" "$(SolutionDir)DAL\cptt.edmx" >nul 2>&1
if errorlevel 1 echo Invalid Manifest token for DAL. Modify cptt.edmx file in a text editor and set the ProviderManifestToken property to 2005.
@Dillie-O
Dillie-O / gist:4162791
Created November 28, 2012 17:43
Pre-Build Event to check for string in file
findstr /c:"[STRING TO FIND]" "$(SolutionDir)[FILE NAME]" >nul 2>&1
if errorlevel 1 echo [YOUR ERROR MESSAGE HERE].
@Dillie-O
Dillie-O / gist:4170237
Created November 29, 2012 16:40
Log4Net Basic TextAppender configuration
<?xml version="1.0" encoding="utf-8"?>
<log4net debug="false">
<appender name="file-appender" type="log4net.Appender.FileAppender">
<file value="log-file.txt" />
<appendToFile value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
@Dillie-O
Dillie-O / gist:4170313
Created November 29, 2012 16:51
Log4Net Initialization code for Global.asax.cs/Application_Start
var log4NetPath = Server.MapPath("~/log4net.config");
log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(log4NetPath));
@Dillie-O
Dillie-O / gist:4170581
Created November 29, 2012 17:27
Log4Net Create SQLite DB Table Code
CREATE TABLE [log4net]
(
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
[appdomain] varchar,
[aspnetcache] varchar,
[aspnetcontext] varchar,
[aspnetrequest] varchar,
[aspnetsession] varchar,
[date] datetime,
[exception] varchar,