Skip to content

Instantly share code, notes, and snippets.

View jaredcnance's full-sized avatar

Jared Nance jaredcnance

  • Amazon Web Services
  • Seattle
View GitHub Profile
@jaredcnance
jaredcnance / ProjectPackageSwitchExample.props
Last active August 8, 2018 17:57
Example for switching between Package and Project References
<!--
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>
@jaredcnance
jaredcnance / boxstarter.ps1
Created July 7, 2018 15:27 — forked from bitcrazed/boxstarter.ps1
Boxstarter script
# 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 17:12
Powershell 'cd' alias
# 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
}
}
$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
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));
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';
}
#!/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"
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)
{
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

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: