Skip to content

Instantly share code, notes, and snippets.

View srmagura's full-sized avatar

Sam Magura srmagura

View GitHub Profile
// OrgMembership.ts
@ManyToOne(() => User, { ref: true, onDelete: 'cascade' })
user: Ref<User>;
// User.ts
@OneToMany(() => OrgMembership, 'user') // 'user' is actually type-safe. You can't just enter any string
orgMemberships = new Collection<OrgMembership>(this);
@srmagura
srmagura / blah.gql
Created March 27, 2023 21:28
phil 3/27
# https://fullcontext.dev/graphql
query Test {
orgsTemp {
id
name
}
}
mutation Test2 {
@srmagura
srmagura / sumRenders.cjs
Created October 21, 2022 17:09
Add up the render times from a React DevTools profiler export
const fs = require("fs");
const path =
"/Users/srmagura/Downloads/profiling-data.10-21-2022.13-06-25.json";
const text = fs.readFileSync(path, { encoding: "utf-8" });
const obj = JSON.parse(text);
const commitData = obj["dataForRoots"][0]["commitData"];
console.log(`${commitData.length} renders`);
export function SignaturePadModal({
order,
vendorPackageIds,
closeRef,
onSubmit,
onClose,
}: SignaturePadModalProps): React.ReactElement {
const onError = useOnError()
const dispatch = useDispatch()
System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.
at ​  .(MainWeb )
at Aspose.Cells.GridWeb.MainWeb.SaveSessionData()
at Aspose.Cells.GridWeb.MainWeb.(bool )
at Aspose.Cells.GridWeb.GridWeb2TagHelper.Process(TagHelperContext context, TagHelperOutput output)
at Microsoft.AspNetCore.Razor.TagHelpers.TagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.RunAsync(TagHelperExecutionContext executionContext)
at AspNetCore.Views_SpreadsheetViewer_Index+<<ExecuteAsync>b__16_1>d.MoveNext() in D:\a\1\s\Source\CaseGuideWeb\Presentation\Website\Views\SpreadsheetViewer\Index.cshtml:line 18
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
@srmagura
srmagura / .editorconfig
Last active October 16, 2023 15:20
.editorconfig with StyleCop and SonarLint rule customizations
[*.cs]
csharp_style_var_for_built_in_types=true:silent
csharp_style_var_when_type_is_apparent=true:silent
csharp_style_var_elsewhere=true:silent
##
## StyleCop.Analyzers
##
# Using directive should appear within a namespace declaration
@srmagura
srmagura / .editorconfig
Last active March 16, 2024 17:19
.editorconfig with some StyleCop rules disabled
[*.cs]
csharp_style_var_for_built_in_types=true:silent
csharp_style_var_when_type_is_apparent=true:silent
csharp_style_var_elsewhere=true:silent
##
## StyleCop.Analyzers
##
# Using directive should appear within a namespace declaration
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="My StyleCop and SonarLint rules" Description="" ToolsVersion="14.0">
<Include Path="StyleCop.Analyzers.ruleset" Action="Default" />
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!-- Using directive should appear within a namespace declaration -->
<Rule Id="SA1200" Action="None" />
<!-- XML comment analysis is disabled due to project configuration -->
<Rule Id="SA0001" Action="None" />
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="My StyleCop rules" Description="" ToolsVersion="14.0">
<Include Path="StyleCop.Analyzers.ruleset" Action="Default" />
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!-- Using directive should appear within a namespace declaration -->
<Rule Id="SA1200" Action="None" />
<!-- XML comment analysis is disabled due to project configuration -->
<Rule Id="SA0001" Action="None" />
const isBrowser: () => boolean = () => typeof window !== 'undefined'
function isInternetExplorer() {
if (!isBrowser())
return false
var ua = window.navigator.userAgent
var msie = ua.indexOf("MSIE ")