Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View smashdevcode's full-sized avatar

James Churchill smashdevcode

View GitHub Profile
const int roleIdScript = 1;
const int roleIdPencils = 2;
context.Roles.AddOrUpdate(
r => r.Id,
new Role() { Id = roleIdScript, Name = "Script" },
new Role() { Id = roleIdPencils, Name = "Pencils" }
);
public static DataTable GetComicBook(int comicBookId)
{
using (var conn = new SqlConnection(ConnectionString))
{
using (var cmd = new SqlCommand($@"
SELECT Id, SeriesId, IssueNumber,
[Description], PublishedOn, AverageRatng
FROM ComicBook
WHERE Id = {comicBookId};
", conn))
public static ComicBook GetComicBook(int comicBookId)
{
using (var context = new Context())
{
return context.ComicBooks
.Where(cb => cb.Id == comicBookId)
.SingleOrDefault();
}
}
@smashdevcode
smashdevcode / tutorial.md
Last active April 11, 2018 14:28 — forked from kenhowardpdx/tutorial.md
Node Quick Start Tutorial Using TypeScript

Initial Setup

Download and install VS Code

Download and install Node

Create a Project Folder & Open VS Code

@smashdevcode
smashdevcode / dotnet-user-auth-s1t1-model-classes.cs
Last active May 30, 2018 21:42
User Authentication with ASP.NET Identity - Reviewing the Project Files - Model Classes
/// <summary>
/// Represents a physical activity.
/// </summary>
public class Activity
{
/// <summary>
/// Constructor for creating activities.
/// </summary>
public Activity()
{
using ComicBookLibraryManagerWebApp.ViewModels;
using ComicBookShared.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using System.Data.Entity;
@smashdevcode
smashdevcode / Repositories_v1.tsx
Last active December 29, 2021 17:52
Dev10 Continuing Education Q4 2021: Introduction to TypeScript
import { useState, useEffect } from 'react';
function Repositories() {
const [repos, setRepos] = useState([]);
return (
<>
<h2>Repositories</h2>
<table>
<thead>
@smashdevcode
smashdevcode / prettier-installation-and-configuration.md
Last active December 10, 2023 19:40
Prettier Installation and Configuration

Prettier Installation and Configuration

  1. Install the prettier package.
npm install --save-dev --save-exact prettier
  1. Add a .vscode folder to your project.
@smashdevcode
smashdevcode / express-starter-app.js
Created December 11, 2023 01:05
Express Starter App
const express = require('express');
// Call the `express` function to create the Express application.
const app = express();
// Define a GET route for the path `/`.
app.get('/', (req, res) => {
// Return a JSON formatted response.
res.json({ message: 'Hello world!' });
});