Skip to content

Instantly share code, notes, and snippets.

@atifaziz
atifaziz / ChangeLog.diff
Created January 21, 2009 20:28
Mono 2.0 to 2.2 LINQ diff
--- mono-2.0\mcs\class\System.Core\System.Linq\ChangeLog 2008-10-02 00:02:58.000000000 +0200
+++ mono-2.2\mcs\class\System.Core\System.Linq\ChangeLog 2008-11-11 06:01:12.000000000 +0100
@@ -2,11 +2,30 @@
* QueryableEnumerable.cs: fix ElementType.
+2008-09-28 Sebastien Pouliot <[email protected]>
+
+ * Enumerable.cs: Add missing cast Average on IEnumerable<long?> to
+ ensure the result is not truncated.
@atifaziz
atifaziz / JsonMLDemo.cs
Created February 3, 2009 08:21
JsonML with Jayrock
using System;
using System.IO;
using System.Xml;
using Jayrock.Json;
using Jayrock.JsonML;
// See: http://groups.google.com/group/jayrock/t/50be3a3931c39f78
public class Program
{
using System;
using System.Collections;
using System.Diagnostics;
using Jayrock.JsonRpc;
using Jayrock.Services;
public class MyJsonRpcDispatcher : JsonRpcDispatcher
{
public MyJsonRpcDispatcher(IService service) :
base(service) { }
@atifaziz
atifaziz / tweet.py
Created February 11, 2009 19:36
IronPython script to update Twitter status
# Tweet - Status update tool for twitter.com
# Copyright (c) 2009 Atif Aziz. All rights reserved.
#
# Author(s):
#
# Atif Aziz, http://www.raboof.com
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the New BSD License, a copy of which should have
# been delivered along with this distribution.
@atifaziz
atifaziz / gist:67169
Created February 19, 2009 22:44
LINQ query to generate table of MoreLINQ operators
(
from member
in XDocument.Load(@"C:\MoreLINQ\MoreLinq\bin\Debug\MoreLinq.xml")
.Root
.Elements("members")
.Elements("member")
let memberName = (string) member.Attribute("name")
let match = Regex.Match(memberName,
@"M:MoreLinq\.Pull\.(?<cat>[a-z]+)\.(?<op>[a-z]+)",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)
using System;
using System.IO;
using System.Xml;
using Jayrock.Json;
using Jayrock.JsonML;
public class Program
{
public static void Main()
{
// Demo for:
// http://groups.google.com/group/jayrock/t/878df871a14df35b
using System;
using Jayrock.Json;
using Jayrock.Json.Conversion;
interface IFoo
{
string Text { get; }
@atifaziz
atifaziz / desvn.bat
Created March 5, 2009 11:12
Removes all .svn folders
REM DESVN
REM
REM Removes all .svn folders under the current directory
REM or a specific directory so that it is no longer
REM treated as a working copy of an SVN repository.
REM
REM Written by Atif Aziz (http://www.raboof.com)
REM
REM Public Domain
REM
@atifaziz
atifaziz / DecoderFlags.py
Created March 31, 2009 13:14
Script to display flags of GDI+ image decoders
# Prints flags of GDI+ image decoders
import clr
clr.AddReference('System.Drawing')
from System.Drawing.Imaging import ImageCodecInfo
decoders = ImageCodecInfo.GetImageDecoders()
print '\n'.join(
['%-20s: Flags = %s' % (d.CodecName, str(d.Flags))
for d in decoders])
@atifaziz
atifaziz / ConnectionStringEditorDemo.py
Created April 16, 2009 07:43
Demonstrates using ConnectionStringEditor
import clr, sys
clr.AddReference('System.Design')
from System.Web.UI.Design import ConnectionStringEditor
from System.ComponentModel import ITypeDescriptorContext
class TypeDescriptorContext(ITypeDescriptorContext):
def get_Instance(self):
return None
Instance = property(get_Instance)