Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Home School Schedule

8:30 - Breakfast

9:30 - Learning Time (Reading, flashcards, green pack...)

10:30 - Movement Time (Go Noodle or yoga)

11:00 - Creative Activity (Coloring, painting, craft...)

@osmyn
osmyn / History\-10bb868f\entries.json
Last active January 13, 2023 17:46
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///d%3A/code/nw/northwell-gigya-tools/tests/readme.md","entries":[{"id":"kf9V.md","timestamp":1661780891576}]}
@osmyn
osmyn / recalc_table_shading.js
Created February 22, 2019 15:10
Recalculates a bootstrap table's row shading after rows hidden
$("tr:visible").each(function (index) {
$(this).css("background-color", !!(index & 1) ? "rgba(0,0,0,0)" : "rgba(0,0,0,.05)");
});
@osmyn
osmyn / FileHelper.cs
Last active January 4, 2019 21:12
File utilities
using BusinessLogic.Utilities.Interfaces;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BusinessLogic.Logging;
@osmyn
osmyn / coverage.runsettings
Created December 26, 2018 13:54
Example unit test runsettings file to exclude tests based on name, library, method, etc.
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<!-- Configurations that affect the Test Framework -->
<RunConfiguration>
<MaxCpuCount>1</MaxCpuCount>
<!-- Path relative to solution directory -->
<ResultsDirectory>.\TestResults</ResultsDirectory>
<!-- x86 or x64 -->
<!-- You can also change it from menu Test > Test Settings > Default Processor Architecture -->
public Mock<IService> DefaultService()
{
var mock = new Mock<IService>();
mock.Setup(x => x.MyMethod(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
.Returns<string, string, string>((typeName, comments, updatedBy) => Task.Run(() =>
new MyType
{
TypeName = typeName,
Comments = comments,
UpdatedBy = updatedBy
//ASYNC
[TestMethod]
public void GetTypesByName_WhenNoNameProvided_ThrowsArgumentException()
{
//Arrange
var builder = new TypeServiceBuilder();
var service = builder.Build();
//Act
Func<Task> call = async () => await service.GetTypesByName(null);
@osmyn
osmyn / TSQL-to-POCO
Last active August 14, 2018 20:31 — forked from joey-qc/TSQL-to-POCO
A simple TSQL script to quickly generate c# POCO classes from SQL Server tables and views. You may tweak the output as needed. Not all datatypes are represented but this should save a bunch of boilerplate coding. USAGE: Run this query against the database of your choice. The script will loop through tables, views and their respective columns. Re…
declare @tableName varchar(200)
declare @columnName varchar(200)
declare @nullable varchar(50)
declare @datatype varchar(50)
declare @maxlen int
declare @sType varchar(50)
declare @sProperty varchar(200)
DECLARE table_cursor CURSOR FOR
@osmyn
osmyn / EFSaveChangesOverride.cs
Last active March 29, 2018 19:25
I often create an override in EF for save changes that handles read only and updatable entities
public override int SaveChanges()
{
var changed = ChangeTracker.Entries()
.Where(e => e.State == EntityState.Modified || e.State == EntityState.Added);
foreach (var item in changed)
{
if (item.Entity is IReadOnlyEntity)
{
item.State = EntityState.Unchanged;