Skip to content

Instantly share code, notes, and snippets.

View KyleMit's full-sized avatar

Kyle Mitofsky KyleMit

View GitHub Profile
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 November 16, 2014 09:52
Conway's Game of Life
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 August 29, 2015 14:11
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 January 21, 2015 01:43
Validation Attribute for phone numbers that will run on the server and client
<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 June 9, 2021 03:31
How to: Implement CopyToDataTable<T> Where the Generic Type T Is Not a DataRow
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 February 2, 2023 00:26
Heartbeat to Keep Session Alive in ASP.NET MVC
[HttpPost]
public JsonResult KeepSessionAlive()
{
return new JsonResult {Data = "Success"};
}

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 January 25, 2018 03:29
Used to help debug input and output for T4 templates and expose values in ModelMetatdata
<#@ 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 December 2, 2018 20:41
JavaScript Samples with Arrays & Functions
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 02:13
How to clone all repos at once from GitHub?

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