This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple example, can of course be simplified using a ioc wrapper. | |
public void Button1_Clicked(object source, EventArgs empty) | |
{ | |
using (var scope = Program.Autofac.BeginLifetimeScope()) | |
{ | |
var uow = scope.Resolve<IUnitOfWork>(); | |
var repos = scope.Resolve<IUserRepository>(); | |
var user = repos.GetUser(1); | |
user.LastName = txtLastName.Text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <windows.h> | |
#include <winsock.h> | |
#include <wininet.h> | |
#include <shellapi.h> | |
#include <mmsystem.h> | |
typedef struct vs { | |
char host[128]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import re | |
import shutil | |
import argparse | |
import binascii | |
# | |
# Author: Daxda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IQueryable<T> FindBy(Expression<Func<T, bool>> predicate, params Expression<Func<T, object>>[] includes) | |
{ | |
var query = GetAll().Where(predicate); | |
return includes.Aggregate(query, (current, includeProperty) => current.Include(includeProperty)); | |
} | |
// Sample usage | |
userRepository.FindBy(x => x.Username == username, x.Roles) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void ProcessHelper(string fileName, string arguments, bool showResultsinConsole) | |
{ | |
// Start the child process. | |
using (var p = new Process{ | |
StartInfo = | |
{ | |
UseShellExecute = false, | |
CreateNoWindow = true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
using System.Threading; | |
using Microsoft.Win32.SafeHandles; | |
namespace ConsoleApplication | |
{ | |
public class ProcessUtil : IDisposable | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net.Http; | |
using System.Text.RegularExpressions; | |
using System.Web; | |
using System.Web.Http; | |
using System.Web.Http.Routing; | |
using System.Web.Mvc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net.Http; | |
using System.Text.RegularExpressions; | |
using System.Web; | |
using System.Web.Http; | |
using System.Web.Http.Routing; | |
using System.Web.Mvc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var expect = require('expect') | |
var _matches = { | |
'{': { invert: '}', isOpening: true }, | |
'}': { invert: '{', isOpening: false }, | |
'(': { invert: ')', isOpening: true }, | |
')': { invert: '(', isOpening: false }, | |
'[': { invert: ']', isOpening: true }, | |
']': { invert: '[', isOpening: false } | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<configuration> | |
<connectionStrings> | |
<add name="hockeydb" | |
connectionString="Server=127.0.0.1;Port=5432;Database=hockeydb;User Id=demo;Password=demo;" | |
providerName="Npgsql" | |
/> | |
</connectionStrings> | |
<system.data> |