Skip to content

Instantly share code, notes, and snippets.

Steve Ognibene nycdotnet

Block or report user

Report or block nycdotnet

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
@nycdotnet
nycdotnet / Program.cs
Created May 29, 2019
Protobuf Example
View Program.cs
using ProtobufExample.Protos;
using System;
namespace ProtobufExample
{
class Program
{
static void Main(string[] args)
{
var product = new Product { Id = 2, Description = "Fun product" };
@nycdotnet
nycdotnet / chocolatey.md
Last active Aug 30, 2019
Chocolatey Packages I use
View chocolatey.md

I like to use the following Chocolatey packages

docker-desktop
git.install
vscode
paint.net
7zip.install
nvm
View Program.cs
using Autofac;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Threading;
// You must add the `Autofac` and `Microsoft.Extensions.Configuration` NuGet packages for this to work
namespace AutofacDemo
@nycdotnet
nycdotnet / ConstructionPerf.txt
Last active Mar 4, 2019
ImmutableDictionary vs ReadOnlyDictionary vs Dictionary Benchmarks with .NET Core SDK 3.0-preview2
View ConstructionPerf.txt
BenchmarkDotNet=v0.11.4, OS=Windows 10.0.17134.590 (1803/April2018Update/Redstone4)
Intel Core i7-6600U CPU 2.60GHz (Skylake), 1 CPU, 4 logical and 2 physical cores
.NET Core SDK=3.0.100-preview-010184
[Host] : .NET Core 2.1.8 (CoreCLR 4.6.27317.03, CoreFX 4.6.27317.03), 64bit RyuJIT
MediumRun : .NET Core 3.0.0-preview-27324-5 (CoreCLR 4.6.27322.0, CoreFX 4.7.19.7311), 64bit RyuJIT
Job=MediumRun Toolchain=.NET Core 3.0 Preview 2 InvocationCount=1
IterationCount=15 LaunchCount=2 UnrollFactor=1
WarmupCount=10
@nycdotnet
nycdotnet / Program.cs
Created Jan 2, 2018
SQL Server Isolation Modes
View Program.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using Dapper;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace isolationmode_demo
@nycdotnet
nycdotnet / code.cs
Created Oct 9, 2017
Get Constants On Type
View code.cs
/// <summary>
/// Enumerates constants on a type.
/// </summary>
public static IEnumerable<FieldInfo> GetConstantsOnType(Type TypeToReflect)
{
return TypeToReflect.GetFields().Where(f => f.IsStatic && f.IsLiteral);
}
/// <summary>
/// Enumerates constants on a type of a type.
@nycdotnet
nycdotnet / Gruntfile.js
Created Jul 25, 2016
Run QUnit from command-line with Grunt
View Gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
qunit: {
default: {
options: {
urls: ["http://localhost:8000/tests/tests.html"]
}
}
},
connect: {
@nycdotnet
nycdotnet / test.ts
Created Aug 20, 2015
http self-request
View test.ts
// demo of web server and client request. Lines 17 or 18 can be used and it works.
import http = require('http');
class Test {
request: http.ClientRequest;
private Connect() {
console.log("connecting");
this.request = http.request({
hostname: "localhost",
@nycdotnet
nycdotnet / exec.ts
Created Jun 1, 2015
Asynchronous Promise-based exec demo
View exec.ts
import {Promise as Promise} from 'es6-promise';
module exec {
function doExec(shouldSucceed: boolean) : Promise<number> {
return new Promise((resolve, reject) => {
doSubExec(shouldSucceed)
.then((result) => {
resolve(result);
},(error) => {
@nycdotnet
nycdotnet / Program.cs
Created Jun 1, 2015
Get releases info from GitHub API
View Program.cs
using System.IO;
using System.Net;
namespace getReleaseInfo
{
class Program
{
static void Main(string[] args)
{
You can’t perform that action at this time.