Skip to content

Instantly share code, notes, and snippets.

View mattcan's full-sized avatar

Matthew Cantelon mattcan

View GitHub Profile
did:3:bafyreihrkkiagg6jit2xuxla4lq4vulvloti5qjvzkbvpczgabf6u3uvvq
@mattcan
mattcan / keybase.md
Last active May 8, 2018 15:57
My Keybase proof, if it wasn't clear.

Keybase proof

I hereby claim:

  • I am mattcan on github.
  • I am mattcan (https://keybase.io/mattcan) on keybase.
  • I have a public key ASCN7XUd8jQvMW1xW91fHqqB17fMV3-2uBZZ_ySs63KzAAo

To claim this, I am signing this object:

@mattcan
mattcan / setcodes.json
Created September 5, 2016 19:34
Pokemon Trading Card Game Online (PTCGO) set code to TCG set code
{
"sets": {
"HS": "hgss1",
"UL": "hgss2",
"UD": "hgss3",
"TM": "hgss4",
"CL": "col1",
"PR-BLW": "bwp",
"BLW": "bw1",
"EPO": "bw2",
@mattcan
mattcan / regexvs.md
Created March 21, 2016 17:08
Regex Searches for Visual Studio
  • Finding Response.Redirect where only one parameter is used (this is imperfect)

    Response.Redirect\([^,]+\);
@mattcan
mattcan / GRANT.sql
Created October 6, 2015 22:54
Setting execute on a schema in SQL Server tends to evade my memory
GRANT EXECUTE ON SCHEMA :: <schema here> TO <user/role here>;

Developer Cheat Sheets

This are my cheat sheets that I have compiled over the years. Tired of searching Google for the same things, I started adding the information here. As time went on, this list has grown. I use this almost everyday and this Gist is the first bookmark on my list for quick and easy access.

I recommend that you compile your own list of cheat sheets as typing out the commands has been super helpful in allowing me to retain the information longer.

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 28/10/2014
  • Original post

@mattcan
mattcan / StringFormat.vb
Last active December 15, 2015 16:19
Works similar to String.Format in .NET. Takes in a string and fills in the {n} variables.
' Needs error checking and to handle more than just strings
' Usage:
' StringFormat("My {2} dogs are {0}, {3}, and {1}.", "Dumbo", "Tim", "3", "Marsha")
Function StringFormat(ByVal ParseTemplate As String, ByVal Arg As String, ParamArray Args() As Variant) As String
Dim lastItemIndex As Integer, combinedArgs() As Variant
' Combine the passed in arguments
If Not UBound(Args) < LBound(Args) Then
ReDim combinedArgs(0 To UBound(Args) + 1)
@mattcan
mattcan / TextStreamFactory.bas
Last active December 11, 2015 20:49
I always forget how to create a new text file so I put together this factory. You will need to reference the Microsoft Scripting Runtime library in your VBA project.
' Make sure you've referenced the Microsoft Scripting Runtime library in your project
' In the VBA Editor: Tools > References...
Function TextStreamFactory(ByVal NewFileName As String) As Scripting.TextStream
Dim fs As New Scripting.FileSystemObject
Dim ts As Scripting.TextStream
Set ts = fs.CreateTextFile(NewFileName)
Set TextStreamFactory = ts
End Function
@mattcan
mattcan / FindValue.vb
Last active October 14, 2015 00:18
Takes the name of a field in a string, the character after the value, and returns the value in an adjacent column. I used this to parse a few hundred URLs for the value of the username.
Sub FindValue()
Dim ws As Excel.Worksheet
Set ws = ActiveSheet
Dim i As Integer, lastRow As Integer
lastRow = 328
Dim fromCol As String, toCol As String, field As String, delim As String
fromCol = "C"