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 / 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"
@mattcan
mattcan / SplitColumn.vb
Last active October 13, 2015 14:37
Splits text in one column into two
Sub SplitColumn( _
ByVal LastRow As Long, _
ByVal DataCol As String, _
ByVal FirstPartCol As String, _
ByVal SecondPartCol As String, _
ByVal DelimCharacter As String _
)
Dim data_col As String, col_one As String, col_two As String, delimiter As String
data_col = DataCol
@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>;
@mattcan
mattcan / count-to-ten.b
Created May 17, 2012 14:41
A program that counts to ten, outputting each value along the way
++++++++++ set loop counter to ten
[
>>>>+++ increase 5th cell by 3
<<<<- decrease loop counter
]
>>>>++ increase 5th cell by 2 to make the 'Space' ASCII code
<<<<++++++++++ reuse 1st cell as loop counter increase to ten
[
>+++++ increase 2nd cell by 5
>+++++ increase 3rd cell by 5