Skip to content

Instantly share code, notes, and snippets.

View CalvinRodo's full-sized avatar

Calvin Rodo CalvinRodo

View GitHub Profile
Imports System.Runtime.CompilerServices
Module DBNullExtensions
<Extension()>
Public Function Coalesce(of T as {New})(obj as Object, alt as T) as T
If (obj is DBNull.Value) Then
return alt
End If
'Original
Public Shared Function FormatClientNumber(num As String) As String
Dim count As Integer = num.Length \ 3
If num.Length Mod 3 = 0 Then count -= 1 'no trailing dash
'If count > 3 Then count = 3 'format is ABC-999-999-123456789..
For i As Integer = count To 1 Step -1
num = num.Insert(i * 3, "-")
Next
@CalvinRodo
CalvinRodo / class.java
Created June 21, 2012 14:01 — forked from anonymous/class.java
is this done correctly?
Public void CalculatePrivateRoom(){
type = "Private";
cost = privateRoom;
medication *= 2;
cost *= noOfDays;
medication *= noOfDays;
telephone *= noOfDays;
television *= noOfDays;
total = television + telephone + medication + cost;
}
@CalvinRodo
CalvinRodo / gist:2946114
Created June 18, 2012 00:06
Sass wedding colors
//colors
$grey: #A1A1A1;
$lightblue: #238DAF;
$navyblue: #00526B;
$yellow: #FFE433;
$white: #FFFFFF;
@CalvinRodo
CalvinRodo / gist:2917566
Created June 12, 2012 13:39
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
for (int j = 0; j < 8; j++)
{
long firstCalc = CRCTable[counterOne] << 1;
long secondCalc = CRCTable[counterOne] & (1 << 31); //or CRCTable[counterOne] & (5)
CRCTable[counterOne] = firstCalc ^ ((secondCalc == 0)? polynom : 0);
}
//Or this would also be equivelant
@CalvinRodo
CalvinRodo / gist:2771479
Created May 22, 2012 20:38 — forked from dx7/gist:1333785
Installing ruby-debug with ruby-1.9.3-p0
# Install with:
# bash < <(curl -L https://raw.github.com/gist/2771479)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@CalvinRodo
CalvinRodo / lastfm.js
Created May 17, 2012 12:43 — forked from theVDude/lastfm.js
Last.fm plugin for ircnode bot using mongodb
// A last.fm nowplaying plugin.
// Author: thevdude ([email protected])
//
// Uses installed node modules mongoose, lastfm, inflection, and bitly.
//
// Current functions include:
// Display user's currently or last played track (np)
// Compare lastfm users with the tasteometer (cp)
// Get a users lastfm url (url)
// Find a user's top ten artists for different time periods (topten)
@CalvinRodo
CalvinRodo / MapperExample.vb
Created May 14, 2012 18:57
Mapper Example.
Class Foo
<Convertible()>
Public Property String Baz
<Convertible()>
Public Propery String Faz
End Class
Class Bar
<ErrorMessage(“Error Converting BAZ”)>
@CalvinRodo
CalvinRodo / gist:2660366
Created May 11, 2012 15:14
Calling Stored Procs in C#
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Oracle.DataAccess.Client;
using System.Diagnostics;
namespace DataBase
{