Skip to content

Instantly share code, notes, and snippets.

@jtmueller
jtmueller / gist:2401291
Created April 16, 2012 20:26
Google Code Jam Problem A in C#
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
public static class Decoder
{
private const string inputFile = "A-small-practice.in.txt";
private static readonly string[] crypt = new[] { "ejp mysljylc kd kxveddknmc re jsicpdrysi",
var cnStr = ConfigurationManager.ConnectionStrings["foo"].ConnectionString;
using (var conn = new SqlConnection(cnStr))
using (var cmd = conn.CreateCommand())
{
// if you use a stord proc, change the type, and put the proc name in CommandText
cmd.CommandType = CommandType.Text;
cmd.CommandText = "IF NOT EXISTS (SELECT fooID FROM table WHERE fooID = @fooID) BEGIN " +
"INSERT INTO table (fooID, a, b, c, d) " +
"VALUES (@fooID, @a, @b, @c, @d) END";
var id = cmd.Parameters.Add("@fooID", SqlDbType.Int);
@jtmueller
jtmueller / gist:1175065
Created August 27, 2011 06:26
Chrome Frame Prompt
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!--[if lt IE 8 ]>
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
<![endif]-->
</head>