Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
#BlackLivesMatter

Kyle KyleMit

💭
#BlackLivesMatter
View GitHub Profile
View RebuildDependencies.sql
DECLARE @str NVARCHAR(MAX) SELECT @str = N''
SELECT @str = @str + 'exec sp_refreshsqlmodule '''
+ SCHEMA_NAME([schema_id]) + '.' + OBJECT_NAME([object_id])
+ '''' + CHAR(13) + CHAR(10)
FROM sys.objects o
WHERE [type] IN ('FN', 'IF', 'P', 'TF', 'V')
AND is_ms_shipped = 0
AND NOT EXISTS (SELECT 1 FROM sys.sql_modules m
WHERE m.[object_id] = o.[object_id]
@KyleMit
KyleMit / life.rb
Created Nov 16, 2014
Conway's Game of Life
View life.rb
module Life
def self.next_grid live_cells_in_grid
new_grid = Set.new
potential_cells(live_cells_in_grid).each do |cell|
alive = live_cells_in_grid.include?(cell)
neighbors = live_neighbors_count(live_cells_in_grid, cell)
if next_state_alive(alive, neighbors)
new_grid << cell
end
@KyleMit
KyleMit / Snowflake.svg
Last active Aug 29, 2015
Snowflake.svg
View Snowflake.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@KyleMit
KyleMit / PhoneRegularExpressionAttribute.vb
Created Jan 21, 2015
Validation Attribute for phone numbers that will run on the server and client
View PhoneRegularExpressionAttribute.vb
<AttributeUsage(AttributeTargets.Field Or AttributeTargets.Property, AllowMultiple:=False)>
Public Class PhoneAttribute : Inherits RegularExpressionAttribute
Private Const _pattern As String = "^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$"
Private Const _msg As String = "Format for {0} must be (888)-888-8888."
Public Sub New()
MyBase.New(_pattern)
Me.ErrorMessage = _msg
DataAnnotationsModelValidatorProvider.RegisterAdapter(
@KyleMit
KyleMit / CustomLINQtoDataSetMethods.vb
Last active Jun 9, 2021
How to: Implement CopyToDataTable<T> Where the Generic Type T Is Not a DataRow
View CustomLINQtoDataSetMethods.vb
Imports System
Imports System.Data
Imports System.Runtime.CompilerServices
Imports System.Reflection
Imports System.Collections.Generic
''' <summary>
''' How to: Implement CopyToDataTable<T> Where the Generic Type T Is Not a DataRow
''' </summary>
''' <remarks>
@KyleMit
KyleMit / HomeController.cs
Last active Jun 9, 2021
Heartbeat to Keep Session Alive in ASP.NET MVC
View HomeController.cs
[HttpPost]
public JsonResult KeepSessionAlive()
{
return new JsonResult {Data = "Success"};
}
View PMI ACP Notes.md

Instructor:

  • David Kearns, MBA, PMP, ACP
  • Working on VT Health Connect

Logistics

  • Start/Stop
  • Homework
    • 16 Page Scrum white paper
@KyleMit
KyleMit / TestT4.cs.t4
Created Jan 25, 2018
Used to help debug input and output for T4 templates and expose values in ModelMetatdata
View TestT4.cs.t4
<#@ template language="C#" HostSpecific="True" #>
<#@ output extension=".txt" #>
<#@ include file="Imports.include.t4" #>
<#@ include file="ModelMetadataFunctions.cs.include.t4" #>
T4 Info Dump
ViewName: <#= ViewName #>
ViewDataTypeName: <#= ViewDataTypeName #>
IsPartialView: <#= IsPartialView #>
IsLayoutPageSelected: <#= IsLayoutPageSelected #>
@KyleMit
KyleMit / arraysamples.js
Created Dec 2, 2018
JavaScript Samples with Arrays & Functions
View arraysamples.js
var consoleHeader = "color: rebeccapurple; font-size: large";
console.header = function(text) {console.log(`%c${text}`,consoleHeader)}
console.header("Array of Objects");
// delcare array of objects
var links = [
{ title: "first item", address: "/project"},
@KyleMit
KyleMit / CloneAllRepos.md
Last active May 9, 2020
How to clone all repos at once from GitHub?
View CloneAllRepos.md

Clone all repos from GitHub

Here's a play by play of kenorb's answer to 'How to clone all repos at once from GitHub?' with a breakdown for each command for people (like me) new to bash

TL;DR Run the following command, but replace Kylemit your own Github user name

UserName=Kylemit; \
curl -s https://api.github.com/users/$UserName/repos?per_page=1000 |\
jq -r '.[]|.clone_url' |\
xargs -L1 git clone