Skip to content

Instantly share code, notes, and snippets.

Jared Nance jaredcnance

Block or report user

Report or block jaredcnance

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jaredcnance
jaredcnance / ProjectPackageSwitchExample.props
Last active Aug 8, 2018
Example for switching between Package and Project References
View ProjectPackageSwitchExample.props
<!--
export WORKSPACE_PATH=~/dev
- figure out if it is possible to create delimited lists in msbuild properties
e.g. export WORKSPACE_PROJECT_PATHS=~/dev/Bar/src/Bar.csproj;~/dev/Foo/Foo.csproj
-->
<PropertyGroup>
<JsonApiDotNetCoreRelativePath>/JsonApiDotNetCore/src/JsonApiDotNetCore.csproj<JsonApiDotNetCoreRelativePath>
</PropertyGroup>
View boxstarter.ps1
# Description: Boxstarter Script
# Author: Rich Turner <rich@bitcrazed.com>
# Last Updated: 2017-06-07
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# start http://boxstarter.org/package/nr/url?<URL-TO-RAW-GIST>
#---- TEMPORARY ---
Disable-UAC
@jaredcnance
jaredcnance / cd-alias.ps1
Created May 16, 2018
Powershell 'cd' alias
View cd-alias.ps1
# usage: . ./cd-alias.ps1
# cd ..
function CheckLastExitCode {
param ([int[]]$SuccessCodes = @(0), [scriptblock]$CleanupScript=$null)
if ($SuccessCodes -notcontains $LastExitCode) {
$msg = "EXE RETURNED EXIT CODE $LastExitCode"
throw $msg
}
}
View check_port_exhaustion.ps1
$Total = Invoke-Command -ScriptBlock {netsh int ipv4 show dynamicport tcp}
$regex = new-object System.Text.RegularExpressions.Regex ('(Number of Ports : )(\d*)', [System.Text.RegularExpressions.RegexOptions]::MultiLine)
$Total = ($regex.Match($Total)).Groups[2].Value
$InUse = Invoke-Command -ScriptBlock {(netstat -an | ? {($_ -notmatch 'LISTENING')}).Count}
Write-Output$InUse/$Total ports in use”
View CancellablePromise.test.ts
import CancellablePromise from '../CancellablePromise';
import Sleep from '../../../test/tools/Sleep';
describe('CancellablePromise', () => {
it('can be awaited', async () => {
let completed = false;
let basePromise = new Promise(resolve => {
setTimeout(resolve, 200);
}).then(() => (completed = true));
View Client.test.ts
import Identifiable from '../../models/Identifiable';
import Error from 'models/Error';
import Client from '../Client';
const { fetch } = global as any;
class Model implements Identifiable {
id: number;
name: string = 'name';
}
View pre-commit-add-to-sln.sh
#!/bin/sh
#
# This is a pre-commit script that will automatically ensure any new .csproj files
# have been added to the AllProjects solution. AllProjects the solution used on the build
# server and must be kept up to date.
#
# This will fail if you do not have VS 2017+ or the dotnet-cli installed.
solution="AllProjects.sln"
View FunctionRunner.cs
internal class FunctionRunner
{
private static readonly string FuncExePath = GetPath(Environment.SpecialFolder.ApplicationData, "npm\\node_modules\\azure-functions-core-tools\\bin\\func.exe");
private readonly string _functionDirectory;
private readonly int _timeouteSeconds;
public FunctionRunner(
string relativeFunctionDirectory,
int timeoutSeconds = 15)
{
View LICENSE
Copyright (c) 2017 Jared Nance
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
View keybase.md

Keybase proof

I hereby claim:

  • I am jaredcnance on github.
  • I am jaredcnance (https://keybase.io/jaredcnance) on keybase.
  • I have a public key ASB4qEECbSmNrElO02tVHwUkuvXDl6ba9BCJf1bKri_QAAo

To claim this, I am signing this object:

You can’t perform that action at this time.