Skip to content

Instantly share code, notes, and snippets.

View vcsjones's full-sized avatar
㊙️

Kevin Jones vcsjones

㊙️
View GitHub Profile
@vcsjones
vcsjones / gist:1444744
Created December 7, 2011 21:28
OracleParameter throwing exception
OracleParameter paramString = new OracleParameter();
paramString.Value = OracleString.Null;
var sizeStr = paramString.Size; //barf
OracleParameter paramBinary = new OracleParameter();
paramBinary.Value = OracleBinary.Null;
var sizeBin = paramBinary.Size; //barf
@vcsjones
vcsjones / updatesauceLabsresults
Created January 3, 2012 19:48 — forked from tarun3kumar/updatesauceLabsresults.java
Update SauceLabs Results
```java
@AfterMethod(alwaysRun = true)
public void shutDownDriver(ITestResult result) throws IOException {
}@AfterMethod(alwaysRun = true)
public void shutDownDriver(ITestResult result) throws IOException {
// Update SauceLabs result
if(testbed.equals("saucelab")) {
String jobID = ((RemoteWebDriver)driver).getSessionId().toString();
SauceREST client = new SauceREST("username", "key");
@AfterMethod(alwaysRun = true)
public void shutDownDriver(ITestResult result) throws IOException {
}@AfterMethod(alwaysRun = true)
public void shutDownDriver(ITestResult result) throws IOException {
// Update SauceLabs result
if(testbed.equals("saucelab")) {
String jobID = ((RemoteWebDriver)driver).getSessionId().toString();
SauceREST client = new SauceREST("username", "key");
Map<String, Object>sauceJob = new HashMap<String, Object>();
@vcsjones
vcsjones / gist:1989421
Created March 6, 2012 22:24
Parsing different DateTime formats
'Make sure this import is at the top of the file:
Imports System.Globalization
'And the actual code:
Public Function ParseDateTime(ByVal dateTimeString As String) As DateTime?
Dim dt As DateTime
'Try to parse the date time...
If DateTime.TryParseExact(dateTimeString, New String() {"yyyyMMdd", "yyyy-MM-dd"}, CultureInfo.CurrentCulture, DateTimeStyles.None, dt) Then
public class IFoo
{
public object Current { get; set; }
public bool MoveNext()
{
return whatever;
}
}
public class Bar
@vcsjones
vcsjones / gist:2631595
Created May 8, 2012 00:13
A Terrible Idea
public async Task<string> Foo
{
set
{
}
get
{
}
}
@vcsjones
vcsjones / gist:2659633
Created May 11, 2012 13:34
LDP GUID Fixer
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Imports System.Text
Public Module EditorMacro
@vcsjones
vcsjones / gist:2711667
Created May 16, 2012 16:05
Capture All Monitors
[STAThread]
static void Main()
{
var size = Screen.AllScreens.Aggregate(Size.Empty, (sz, screen) =>
{
var boundHeight = screen.Bounds.Y + screen.Bounds.Height;
var boundWidth = screen.Bounds.X + screen.Bounds.Width;
return new Size(boundWidth > sz.Width? boundWidth : sz.Width, boundHeight > sz.Height? boundHeight : sz.Height);
});
using (var bitmap = new Bitmap(size.Width, size.Height))
@vcsjones
vcsjones / gist:3426684
Created August 22, 2012 15:18
HandleAsp4Rendering
[Test]
public void ShouldHandleAspNet4Rendering()
{
var text = string.Format("Hello World");
multiline.Text = text;
doPostBack.Click();
Assert.AreEqual(text, multiline.Text);
}
//Don't Want
Func<bool, bool> someFunc = null;
someFunc = b => someFunc(b);
//Want (Mono C# compiler can do this)
Func<bool, bool> someFunc = b => someFunc(b);