Skip to content

Instantly share code, notes, and snippets.

View CalvinRodo's full-sized avatar

Calvin Rodo CalvinRodo

View GitHub Profile
@CalvinRodo
CalvinRodo / ImprovedPowershellLoading.ps1
Created January 19, 2012 18:19
Improved Module Loading in Windows Powershell profile.
#Add the profile path to the environment path variable
$ProfileRoot = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$env:path = ";$ProfileRoot"
#Load all of the modules from ./Modules/* that aren't already loaded.
(gci $ProfileRoot"/Modules") | ForEach { if ( -Not( Get-Module $_.Name ) ) { Import-Module $_.Name; Write-Host Importing Module: $_.Name } }
@CalvinRodo
CalvinRodo / Piglatin
Created April 4, 2012 19:59 — forked from anonymous/Piglatin
Take word, decide if first letter is capitalized, a vowel, and if the word has any vowels.
#include <iostream>
#include <ctime>
#include <ctype.h>
using namespace std;
const int wordSIZE = 50;
void checkVowel(char word[], int size, bool &first_VOWEL, bool &first_CAP, bool &VOWEL );
int arrayLength(char[]);
@CalvinRodo
CalvinRodo / gist:2407834
Created April 17, 2012 17:57
State Selector
Dim states as Dictionary(Of String, String)() From { {"CA", "California"} }
'to get the name just call where stateCode is the inputted string from the user.
Dim name as String = states(_stateCode)
@CalvinRodo
CalvinRodo / CoalesceExtension.vb
Created April 25, 2012 19:33
A vb.net Coalesce Extension should be strictly typed.
Imports System.Runtime.CompilerServices
<Extension()>
Public Module GenericExtensions
Function Coalesce(Of T)(first As T, second As T) As T
If (first Is Nothing) Then
Return second
End If
Return first
End Function
@CalvinRodo
CalvinRodo / Database.c#
Created May 11, 2012 15:01
Some code for calling stored procs in c# with oracle.
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Oracle.DataAccess.Client;
using System.Diagnostics;
namespace DataBase
{
@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
{
@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 / 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 / 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
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