Skip to content

Instantly share code, notes, and snippets.

Ha Doan hadoan

Block or report user

Report or block hadoan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:747ebbeb5096bb9ebf2761578b430370
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Backup database....");
Backup();
Console.WriteLine("Migrate database ...");
var config = new Configuration();
//... (set up the config object)
View SRP2
public class DataMapper<TEntity, TIDType, TLinqEntity> : IDataMapper<TEntity, TIDType, TLinqEntity>
where TEntity : AbstractBaseData<TIDType>
where TLinqEntity : EntityObject
{
public IList<TEntity> GetEntitiesFromEF(IList<TLinqEntity> linqEntities)
{
Mapper.Initialize
(
cfg =>
{
View SRP1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BlogCode
{
public abstract class RepositoryBase<TEntity, TIDType, TLinqEntity, TContext> : IRepository<TEntity, TIDType, TLinqEntity, TContext>, IDisposable
where TEntity : AbstractBaseData<TIDType>
where TLinqEntity : EntityObject
View ExtremeML
public static void PopulateDataTypesRandom()
{
using (var package = SpreadsheetDocumentWrapper.Open("MyWorkbook.xlsx"))
{
var table = package.WorkbookPart.GetTablePart("DataTypes").Table;
var data = new List<object[]>();
for (var i = 0; i < 10; i++)
{
data.Add(new
View MimeTypeUtility
public static class MimeTypeUtility
{
private const string OctetStream = "application/octet-stream";
private static readonly Dictionary<string, string> MimeTypesDictionary = new Dictionary<string, string>
{
{"ai", "application/postscript"},
{"aif", "audio/x-aiff"},
{"aifc", "audio/x-aiff"},
{"aiff", "audio/x-aiff"},
View ObjectDumper for C#
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Globalization;
View Log to ULS
SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("My Category", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);
View browsermob-selenium
Server server = null;
Client client = null;
FirefoxDriver driver = null;
try
{
// Supply the path to the Browsermob Proxy batch file
server = new Server(ConfigurationManager.AppSettings["BrowserMobBatFile"], 3333);
server.Start();
client = server.CreateProxy();
You can’t perform that action at this time.