Skip to content

Instantly share code, notes, and snippets.

@ianmariano
ianmariano / git-fork-sync
Last active June 26, 2024 17:53
Syncs your repo fork with the upstream master and then pushes the synced master to origin. Presumes you have an 'upstream' remote which is from whence your fork was created. Put on your path and chmod a+x it then do: git fork-sync. Use -h for usage help.
#!/usr/bin/env bash
set -Eeuo pipefail
VERSION="20200421.1"
_usage() {
cat << __EOF
$0 usage:
@riyadparvez
riyadparvez / CsvUtils.cs
Created January 6, 2013 14:48
DataTable to CSV extension methods. Export to CSV file, CSV string
public static class CSV
{
public static string ToCSV(this DataTable table)
{
var columnHeaders = (from DataColumn x in table.Columns
select x.ColumnName).ToArray();
StringBuilder builder = new StringBuilder(String.Join(",", columnHeaders));
builder.Append("\n");
foreach (DataRow row in table.Rows)
@kiliman
kiliman / LinqPadPrecompiler.cs
Created February 29, 2012 22:01
LinqPadPrecompiler for CS-Script http://www.csscript.net/
// Written by Michael Carter ([email protected])
// Copyright (c) 2012. All rights reserved.
//
// Redistribution and use of this code WITHOUT MODIFICATIONS are permitted provided that
// the following conditions are met:
// 1. Redistributions must retain the above copyright notice, this list of conditions
// and the following disclaimer.
// 2. Neither the name of an author nor the names of the contributors may be used
// to endorse or promote products derived from this software without specific
// prior written permission.
@panesofglass
panesofglass / Specification.cs
Created October 26, 2009 16:16
A generic specification base class.
using System;
using System.Linq.Expressions;
namespace Foundation.Specifications
{
/// <summary>
/// Defines an abstract class from which to create conditional specifications.
/// </summary>
/// <typeparam name="T">The type of entity used in the specification.</typeparam>
/// <seealso href="http://ubik.com.au/article/named/implementing_the_specification_pattern_with_linq" />