Skip to content

Instantly share code, notes, and snippets.

View EricRohlfs's full-sized avatar

Eric Rohlfs EricRohlfs

View GitHub Profile
@EricRohlfs
EricRohlfs / rlang_text_corpus_helpers
Created September 19, 2021 17:00
corpus helpers
pivotDFM <- function(dfm){
dfm_dt <- dfm %>%
convert(to ="data.frame") %>%
setDT(keep.rownames = c("docid","doc_id")) #convert to data.table
pivoted <- melt(dfm_dt, id.vars = "docid") %>%
mutate(document = if_else( docid == 1, .$value[1], .$value[2])) %>%
setcolorder(c("docid","document","variable","value")) %>%
<html>
<head>
</head>
<body>
<h1></h1>
<div>My Friends</div>
<ul></ul>
</body>
<script>
// the html specification calls for having the script tag in the head, but this will error out because the body.h1 element would not rendered on the page yet
param($path, $env)
#note: the metrics.exe is managed in the nuget package file for this project
#note: create and use a separate .sln file with only the projects that need scanning. Exclude test projects etc.
# run local command: .\"Deployment Scripts\generate_code_metrics.ps1" "E:\code\ESSO"
$metrics_exe = "$path\packages\Microsoft.CodeAnalysis.Metrics.3.3.0\Metrics\Metrics.exe"
$sln_file = "$path\CodeMetrics.sln"
$metricsHtmlFile = "$path\codeMetrics.html"
<!-- edited from original so might be some issues-->
<table id='oss_report'>
<template id="row">
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
const mockCommit = function (mutations, state) {
return function (type, payload) {
mutations[type](state, payload)
}
}
// how to do async unit test for vuex without creating a full store.
describe('inFlight vuex', () => {
let state
let mutations
# not really complete, but does keep the first few digits in a sharedassembly.cs file script.
##-----------------------------------------------------------------------
## <copyright file="ApplyVersionToAssemblies.ps1">(c) http://TfsBuildExtensions.codeplex.com/. This source is subject to the Microsoft Permissive License. See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. All other rights reserved.</copyright>
##-----------------------------------------------------------------------
# Look for a 0.0.0.0 pattern in the build number.
# If found use it to version the assemblies.
#
# For example, if the 'Build number format' build process parameter
# $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
# then your build numbers come out like this:
# PowerShell script to publish all the nuget packages in a project to VSTS Package server
$Dir = get-childitem D:\_delete\blah\WebApplication4 -recurse
# $Dir |get-member
$List = $Dir | where {$_.extension -eq ".nupkg"}
$List | format-table name
$List | ForEach-Object{
$tempPath = Join-Path $_.Directory $_.name
D:\nuget.exe push -Source "MyNugetServerNameOrUrl" -ApiKey VSTS $tempPath
}
# Downloads all the git projects from a Microsoft Visual Studio Team Services (VSTS) account.
# Helpful if a team has many git repositories.
# change these
$project = "myProject"
$whereToSaveRoot = "d:\myProject\"
# application start
$username = Read-Host -Prompt 'UserName from VSTS Alt Credentials'
(function () {
/**
* Gist by @EricRohlfs for embeding yammer in an AngularJs SPA.
* Assumes you are using open graph and ng-route.
* Steps:
* 1. include the yammer api script as per their documentation
* <script type="text/javascript" src="https://assets.yammer.com/assets/platform_embed.js"></script>
* 2. Add the directives <yammer-embed/> or <yammer-follow/> to your page.
* 3. in your route config add the openGraph property for each route
# ---------- Main Vars to Change-----------------
$contentPath = 'C:\MyApp\content'
# find the file at example : C:\Users\me\AppData\Local\Temp on my computer
$OutPath = "$env:temp\SharePointProjectItem.spdata.fragment.xml"
# --------- End Main Vars to Change------------
# Code Summary