Skip to content

Instantly share code, notes, and snippets.

View cjestal's full-sized avatar
🏠
Working from home

Clint James cjestal

🏠
Working from home
View GitHub Profile
@cjestal
cjestal / moq-steps.txt
Created November 1, 2024 22:05
Some notes from week 9 lecture for unit testing
- create a solution with a console project
- add a test project (right click on the solution)
- open NuGet Package Manager console
- in the console, change the active project to the test project
- type "Install-Package Moq"
- type "Install-Package Nunit"
- alternatively, just search for moq in the package manager ui
@cjestal
cjestal / C# Console App with DB Connection and Migration File
Created September 20, 2024 21:42
C# Console App with DB Connection and Migration File
Pre-requisite:
- create a database
- create some tables in db
Steps:
1. start a console project (.net framework template)
2. once created go to solution explorer, right click on the project (not the solution)
3. add new item
4. in the add new item popup, select ADO.NET Entity Data Model
5. choose "code first from database"
Create CSV file using excel
Open studio 2022
Open SQL Server Management Tool
In studio, start a project
Use “Integration Services Project”
function upperCaseFirst(inputStr) {
var valueOfFirstChar = inputStr.charCodeAt(0);
console.log('Value of first character:', valueOfFirstChar);
var upperCaseLetter = String.fromCharCode(valueOfFirstChar - 32);
console.log('Uppercase first character:', upperCaseLetter);
var restOfString = inputStr.slice(1);
console.log('Rest of the string:', restOfString);
@cjestal
cjestal / config.json
Last active September 11, 2020 11:03
Docker - MySQL image connection refused solution
{
"type": "mysql",
"host": "db", // the image name. do not use localhost
"port": 3306,
"username": "root",
"password": "password",
"database": "",
...
}
@cjestal
cjestal / sendToSlack.js
Created January 26, 2018 03:20 — forked from scripting/sendToSlack.js
A tiny JavaScript app that sends a message to your default Slack channel. Can be customized with a name, icon, emoji or sent to a different channel. Runs in Node.js.
var request = require ("request");
var urlWebHook = "https://hooks.slack.com/services/abcdef"; //the URL you get on your "incoming web hooks" page.
function sendToSlack (s, theUsername, theIconUrl, theIconEmoji, theChannel) {
var payload = {
text: s
};
if (theUsername !== undefined) {
payload.username = theUsername;
@cjestal
cjestal / surface.js
Last active July 30, 2016 09:21 — forked from mknecht/surface.js
Uglfied version of lilobase's for a refactoring example
const boxes = [[2, 3, 4], [1, 1, 10]];
// Calculates the total surface area of a box.
// includes allowance for wrapping a box (packagingBuffer)
function total(boxes) {
var total = 0;
for (var b of boxes) {
var side1 = b[0]*b[1];
var side2 = b[1]*b[2];