Skip to content

Instantly share code, notes, and snippets.

View jmreynolds's full-sized avatar

Joe Reynolds jmreynolds

View GitHub Profile
@jmreynolds
jmreynolds / DumpToExcel.cs
Created March 4, 2016 03:28 — forked from bryanhunter/DumpToExcel.cs
Painless way to build Microsoft Excel spreadsheets from any IEnumerable<T>. Does not require Excel.
using System.Collections.Generic;
using System.IO;
using OfficeOpenXml; // (EPPLus - http://epplus.codeplex.com/)
namespace OfficeReports
{
public static class DumpToExcel
{
public static void Dump<T>(IEnumerable<T> data, string outputFilename)
{
@jmreynolds
jmreynolds / GetDatabaseInfo.linq.cs
Created February 23, 2016 00:13 — forked from jamesmanning/GetDatabaseInfo.linq.cs
LINQPad script to get basic schema information about the currently selected database (assumes LINQPad's default data context creation method)
void Main()
{
var databaseInfo = GetDatabaseInfo(this);
databaseInfo.Dump();
}
// Define other methods and classes here
public class DatabaseInfo
{
public Type DataContextType { get; set; }
@jmreynolds
jmreynolds / google-maps-static-image-generator
Created February 19, 2016 17:21 — forked from katydecorah/google-maps-static-image-generator
Generate a static Google Maps image for Jekyll posts.
{% if page.locations %}
<img src="http://maps.googleapis.com/maps/api/staticmap?{% for location in page.locations %}{% if forloop.first %}center={{location}}&markers=color:blue%7C{{location}}{% else %}&markers=color:blue%7C{{location}}{% endif %}{% endfor %}&zoom={% if page.zoom %}{{page.zoom}}{% else %}13{% endif %}&size=300x200&scale=2&sensor=false&visual_refresh=true" alt="">
{% endif %}
@jmreynolds
jmreynolds / BulkInsertAll.cs
Last active September 8, 2023 10:48 — forked from oshea00/BulkInsertAll.cs
Use SQLBulkLoad with linq-toSQL in LinqPad
// Add this to LinqPad "C# Program"
// Example use:
// Insead of this: (create a List<CS_POSITION>)
// CS_POSITIONs.InsertOnSubmit(position);
// This:
// positions.Add(position);
//
// Then instead of this:
// SubmitChanges()
// This:
@jmreynolds
jmreynolds / 0_reuse_code.js
Created February 1, 2016 23:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jmreynolds
jmreynolds / Program.cs
Last active February 2, 2016 00:21 — forked from svick/Program.cs
C# 6.0 Features: FormattableString on .Net 4.0
using System;
using System.Globalization;
static class Program
{
private static void Main()
{
double d = 3.14;
IFormattable s = $"{d}";
Console.WriteLine(s.ToString(null, CultureInfo.GetCultureInfo("cs-cz")));