Skip to content

Instantly share code, notes, and snippets.

@onwuka
onwuka / UsedBefore.vb
Created December 12, 2012 21:47
Variable is used before it is assigned a value. For Each in VB.NET
Public Function X() As String
Dim s as String = ""
Try
Dim vowels() As String = {"a", "e", "i", "o", "u"}
For Each vowel As String In vowels
s = "0"
Next
Catch ex As Exception
End Try
Return s
@onwuka
onwuka / RedirectTopage.vb
Created December 12, 2012 16:25
Negating the negatives
'So we started with something like this:
If Not X() Then
If A <=0 Then
'Do stuff
End If
End If
'Now, I am modifying it to
If Not X() AndAlso Not Y() Then
If A <=0 Then
@onwuka
onwuka / conditional.vb
Created December 6, 2012 20:12
replacing by andalso
If x.y Is Nothing
AndAlso a IsNot Nothing
AndAlso a.UseTC = True Then
Dim userLang() As String
userLang = Page.Request.UserLanguages
If userLang IsNot Nothing Then
e.c.Set(CurrentSB, userLang(0))
x.y = New ai.e.eCI(userLang(0))
Else
e.c.s(x)
@onwuka
onwuka / CommentAbuse.vb
Created December 5, 2012 19:11
Abuse of comments
Private Function BuildPage() As String
Try
If CurrentSessionBroker.EnableDebugTrace Then
'Big block of commented out code here on how to handle this scenario
'Why does this If block exist if everything inside is gone the way of the dodo?
End If
'...
Catch Ex As Exception
'...
Finally
@onwuka
onwuka / footer.cshtml
Created November 12, 2012 16:16
Do not nest a section tag inside a paragraph tag.
<!--
.:+uuuuuuuuuuu+:.
./sssssssssssssssssssss/-
./aaaaaaaaaaaaaaaaaaaaaaaaaaa/.
.+uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu+.
`/sssssssssssssssssssssssssssssssssss/
`aaaaaaaaaaaaa:-` `-:aaaaaaaaaaaaa.
`uuuuuuuuuuu/. ./uuuuuuuuuuu.
sssssssssss. .sssssssssss`
-aaaaaaaaaa` `+aaaaaaaaa:
@onwuka
onwuka / heartless people.txt
Created October 23, 2012 14:46
Why the f@$! did you get a cat if you are going to abandon them to go to some tropical paradise?
URGENT NEED TO FIND A HOME FOR [CAT NAME] BY [MM/DD] OR SHE GOES TO THE POUND
My son and his family are moving to [Location] in the very near future and really want to find a home for their 10 year old cat.
[Cat name] has always been a house cat and she is declawed. If you know anyone who is interested, please have them call me at [my number].
Thanks so much!