Skip to content

Instantly share code, notes, and snippets.

@copypastedeveloper
copypastedeveloper / FeetWithWithDotNet.cs
Last active April 10, 2024 16:49
feet with with .net goes kinda hard
namespace FeetWithWith;
public class FootMan : IMakeFeet
{
readonly HttpClient _httpClient;
readonly string _apiKey; // Your OpenAI API key
readonly string _dalleApiUrl = "https://api.openai.com/v1/images/generations";
readonly string _gptApiUrl = "https://api.openai.com/v1/completions";
@copypastedeveloper
copypastedeveloper / UploadController.cs
Last active January 25, 2020 19:19 — forked from eouw0o83hf/UploadController.cs
File upload with React component and dotnet core web API controller
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Demo.Web.Controllers
{
public class UploadController : Controller
{
@copypastedeveloper
copypastedeveloper / ERD and database creation.md
Last active December 22, 2018 22:37
Classroom Excercise

Create an ERD and then a database representing these requirements:

Student

  1. First name
  2. Last name
  3. Slack handle
  4. The student's cohort
  5. The collection of exercises that the student is currently working on
@copypastedeveloper
copypastedeveloper / cases.md
Last active September 29, 2018 14:19
Roman Numeral Conversion Cases

As a mediocre superbowl naming person

I want an application that will translate numbers into roman numerals

So that I don't make a mistake when naming all of the superbowls.

Number Roman Numeral
1 I
5 V
@copypastedeveloper
copypastedeveloper / RazorPractice.md
Last active October 14, 2017 14:40
Razor Practice

Razor Exercise

Set Up

Scaffold your application in Visual Studio:

  1. File > New > Project (ctrl + shift + n)
  2. Select Templates > Visual C# > Web > ASP.NET Web Application (.NET Framework)
  3. Name it RazorPractice
  4. Choose the MVC option and click Ok (initializing an empty git repo is a handy option here, too)

In the Index.cshtml in your Views/Home/ folder (correlates to the Home Controller):

Keybase proof

I hereby claim:

  • I am copypastedeveloper on github.
  • I am nathangonzalez (https://keybase.io/nathangonzalez) on keybase.
  • I have a public key ASAqxDV_Pj3vcbDdvcAniwDezySH6fRwy6za2P3qAUS9owo

To claim this, I am signing this object:

<Response>
<Speak>Hello, welcome to the Jungle!</Speak>
</Response>
@copypastedeveloper
copypastedeveloper / TransactionalInvoker
Created June 12, 2014 03:13
example of how to make just about anything transaction aware
public class TransactionalInvoker : IEnlistmentNotification
{
bool _inTransaction;
readonly List<Action> _commitActions = new List<Action>();
public void Invoke(Action action)
{
if (_inTransaction)
{
_commitActions.Add(action);
@copypastedeveloper
copypastedeveloper / EventUpconverter
Created June 10, 2014 03:57
Automapper based Event Upconversion
public class EventUpconverter<TSource, TDestination> : IUpconvertEvents<TSource, TDestination>
where TSource : class,IEvent
where TDestination : class,IEvent
{
readonly IMappingEngine _mapper;
public EventUpconverter(IMappingEngine mapper)
{
_mapper = mapper;
}
@copypastedeveloper
copypastedeveloper / when_building_a_toyota
Last active December 25, 2015 08:28
given nunit example
[Story(AsA = "car manufacturer",
IWant = "a factory that makes the right cars",
SoThat = "I can make money")]
public class building_a_toyota : Scenario
{
static CarFactory _factory;
static Car _car;
given a_car_factory = () =>
{