Skip to content

Instantly share code, notes, and snippets.

@orangutanboy
orangutanboy / DoubleBuffered
Created September 2, 2012 08:12
Sample app showing DoubleBuffered property on DataGridView
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace DoubleBufferExample
{
public partial class TestForm : Form
@orangutanboy
orangutanboy / Calculator.cs
Created May 20, 2012 21:06
133 character bowling game score calc
void c(int[]b,out int t){int n,v,i=t=0,X=10;for(;i<19;i+=2){n=b[i]+b[i+1];v=b[i+2];t+=(n<X)?n:X+v;if(b[i]>9)t+=b[i+(i>16|v<X?3:4)];}}
@orangutanboy
orangutanboy / MyRefactor
Created May 13, 2012 17:19
Refactor of a monster switch statement
using System;
using System.Collections.Generic;
namespace Monster
{
public class MonsterClass
{
public void DoTask()
{
MySqlConnection oSqlConn = new MySqlConnection();
let unitsElement(x) =
match x % 10 with
| 0 -> []
| x -> [ string x ]
let tensElement(x) =
string (x / 10 * 10)
let elementsFor2DigitNumber(x) =
match x with