Skip to content

Instantly share code, notes, and snippets.

View dterracino's full-sized avatar
🐢
I may be slow to respond…

David Terracino dterracino

🐢
I may be slow to respond…
View GitHub Profile
@oliveratgithub
oliveratgithub / MailMergeSaveEachRecordToFile.vba
Created May 9, 2017 20:31
VBA macro for Microsoft Word (Mac + Windows) to Mail Merge each record into separate documents. Execute the following VBA Macro on your Office Word Mail Merge template to have Word generate & save every record into a single file. More information: https://swissmacuser.ch/microsoft-word-mail-merge-into-single-documents/
'More information & instructions:
'https://swissmacuser.ch/microsoft-word-mail-merge-into-single-documents/
Option Explicit
Sub MailMergeSaveEachRecordToFile()
'
' Save each single Mail Merge Record into a seperate Document
'
Dim rec, lastRecord As Integer
Dim docNameField, strDocName, savePath As String
@josheinstein
josheinstein / Http.csx
Created April 26, 2017 19:17
A C# script that contains helper extension methods for the HttpRequestMessage class, to simplify Azure Function development.
#r "System.Management.Automation"
#r "System.Web"
using System.Net;
using System.Net.Http;
public static string Query(this HttpRequestMessage request, string name, string defaultValue = null) {
var pairs = request.GetQueryNameValuePairs().Where(q => String.Equals(q.Key, name, StringComparison.OrdinalIgnoreCase));
if (pairs.Any()) { return pairs.First().Value; }
return defaultValue;
public class LambdaConstructorDelegate : IConstructorDelegate
{
public Func<object[], object> Create(ServiceContract serviceContract)
{
if (serviceContract.ConstructorDelegate != null)
{
return serviceContract.ConstructorDelegate;
}
var delegateParameter = Expression.Parameter(typeof(object[]));
class ElectedOrderedListItem
# subitem: the item itself, the payload
# lowerItems: A list of items that were seen before this item
# seen: How often it was seen before
# rating: rating to store if there is no other way
attr_accessor :payload, :rating, :seen, :lowerItems
def initialize(payload, rating)
@roy-t
roy-t / xna4_vs2017.md
Last active November 8, 2024 12:17
Install XNA 4.0 under Microsoft Visual Studio 2017

This guide will provide you with a workaround for using XNA in Visual Studio 2017. This will solve problems with the target files and Microsoft.Build.Framework.dll such as: Error loading pipeline assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.Build.Framework.dll"

  1. Download a modified version of the XNA vsix: https://mxa.codeplex.com/
  2. Unzip XNA Game Studio 4.0.vsix and replace the <Installation /> tag in extension.vsixmanifest with this:
 <Installation InstalledByMsi="false">
    <InstallationTarget Version="[12.0,16.0)" Id="Microsoft.VisualStudio.VSWinDesktopExpress" />
    <InstallationTarget Version="[12.0,16.0)" Id="Microsoft.VisualStudio.Pro" />
# mol: A maybe ordered list, by preserving some order on merge
#
# Concept:
# We have an ordered list with values. If another list shall be merged in,
# merge each new item below an item known in both lists that has a higher
# value (=big brother), or above one that has a smaller value. If there
# exists no such item, use the item value to find a higher item, and
# insert below. When adding an item that exists already, average its value
# and reposition as if it were a new item.
#
@dbones
dbones / middleware.cs
Created February 11, 2017 23:03
middleware class, which functions like the middleware you will find in .NET Core, Express (on node.js)
namespace MiddleWare.Host
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Autofac;
internal class Program
{
@jpreece6
jpreece6 / ExtensionMethods.cs
Created January 10, 2017 08:59
List extension to split lists into chunks (good for batch processing on threads)
public static class ExtensionMethods
{
public static List<List<T>> Split<T>(this IEnumerable<T> collection, int size)
{
var chunks = new List<List<T>>();
var count = 0;
var temp = new List<T>();
foreach (var element in collection)
{
@oliveratgithub
oliveratgithub / index.html
Last active April 24, 2025 23:06
Simple, quick & standalone HTML5 responsive placeholder Website. Runs by simply copy-paste the whole code without any additional resource files. It's based on PureCSS.io with jQuery containing a fullstretch-background image plugin and a date-time countdown; kudos to unsplash.it for beautiful placeholder images.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Dummy Page</title>
<meta name="description" content="Simple, quick, standalone responsive placeholder Website without any additional resources">
<meta name="author" content="https://gist.github.com/oliveratgithub">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous">
<!--[if lt IE 9]>
@jpreece6
jpreece6 / ExtensionMethods.cs
Created January 4, 2017 20:15
Best method for easy invoke operations
namespace ExtensionMethods
{
public static class ExtensionMethods
{
public static void InvokeIfRequired<T>(this T obj, Action<T> action) where T : Control
{
if (obj.InvokeRequired)
{
obj.Invoke(new Action(() => action(obj)));
}