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 interface IFoo | |
{ | |
bool CanFoo(Bar bar); | |
void DoFoo(Bar bar); | |
} | |
public class Thing | |
{ | |
private IEnumerable<IFoo> _foos; | |
public Thing(IEnumerable<IFoo> foos) |
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
function Customer(name, age) | |
{ | |
this.name = name; | |
this.age = age; | |
} | |
var dave = new Customer("Dave", 35) | |
Dump(dave); | |
var jax = {}; |
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 class TestEndPointController : Controller | |
{ | |
[HttpPost] | |
public ActionResult Record(RecordInputModel model) | |
{ | |
return | |
Json( | |
new | |
{ | |
success = 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
// Querying arrays by their size | |
{ | |
"Field1": {$size: 0} | |
"Field2": {$not: {$size: 0}} | |
} | |
// Querying nested fields using a unique identifier | |
{ | |
"Events.Payload.Body._t" : "EventType", | |
"Events.Payload.Body._id" : CSUUID("2267495d-63e3-4aa3-ae67-86372a7968fd") |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
const string json = "{ \"property\" : \"value\", \"property2\" : 34 }"; | |
var dynamicJsonBuilder = DynamicJsonBuilder.Deserialize(json); | |
string jsonAfterBuilder = dynamicJsonBuilder | |
.WithProperty("value2") | |
.WithProperty2(55) |
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.ObjectModel; | |
using System.Linq.Expressions; | |
namespace CTM.Home.MaiyaReports.Processors | |
{ | |
void Main() | |
{ | |
Expression<Func<ArrayList, bool>> @default = r => r.Count > 0 && r.Count < 2; |
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.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ |
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 static class TypeExtensions | |
{ | |
public static bool HasAttribute<TAttribute>(this Type type) where TAttribute : Attribute | |
{ | |
return type.CustomAttributes.Any(a => a.AttributeType == typeof (TAttribute)); | |
} | |
public static IEnumerable<Type> DerivedTypesFrom<T>(this Assembly assembly) | |
{ | |
return assembly.GetTypes().Where(typeof(T).IsAssignableFrom); |
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
# Show me a list of all processes. If they are a service give their name. | |
# Pipe to findstr which filter out anything that is "N/A" (I.e. only show services) | |
tasklist /SVC | findstr /V /C:"N/A" | |
# show me all listening and sending sockets | |
# -o show me their pid | |
netstat -a -o | findstr 4260 |
OlderNewer