This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def some_method(a, b, c=5, *p, q) | |
| if (q) c=7 | |
| other_method(a,b,c,p,q) | |
| end | |
| def other_method(a, b, c=4, *p, q) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [TestFixture] | |
| public class DispatcherObjectIsAJerk | |
| { | |
| [SetUp] | |
| public void Setup() | |
| { | |
| var task = System.Threading.Tasks.Task.Factory.StartNew(() => | |
| { | |
| System.Windows.Threading.Dispatcher.Run(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void GlobalVariablesGrid_ColumnFix() | |
| { | |
| foreach (var column in GlobalVariablesGrid.Columns) | |
| { | |
| if ("Name".Equals(column.Header)) | |
| { | |
| var dpd = System.ComponentModel.DependencyPropertyDescriptor.FromProperty(DataGridColumn.WidthProperty, typeof(DataGridColumn)); | |
| if (dpd != null) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// The exception that is thrown when you are stupid. | |
| /// </summary> | |
| [Serializable] | |
| public class YouAreStupidException : Exception | |
| { | |
| // constructors... | |
| #region YouAreStupidException() | |
| /// <summary> | |
| /// Constructs a new YouAreStupidException. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class I { public static void f(Func<bool> pred, Action a) { if (pred()) a(); } } | |
| // so that I can use it like this: | |
| dg.CurrentCellChanged += (_, __) => | |
| I.f(()=>rowBeingEdited!=null, ()=>rowBeingEdited.EndEdit()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using NUnit.Framework; | |
| namespace scratch | |
| { | |
| [TestFixture()] | |
| public class Test | |
| { | |
| [Test()] | |
| public void TestCase () | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class DynamicExt | |
| { | |
| public static Dictionary<object, DynamicObject> registry = new Dictionary<object, DynamicObject>(); | |
| public static dynamic AsDynamic(this object source) | |
| { | |
| if (!registry.ContainsKey(source)) | |
| registry[source] = new DynamicObject(source); | |
| return registry[source]; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public virtual List<CreditUnion> ExecuteF(Func<System.Data.IDataReader, CreditUnion> map) | |
| { | |
| var command = _database.GetStoredProcCommand("GETALLA2A");//ENTLIB? | |
| _database.AddInParameter(command, "mode", System.Data.DbType.String, "M"); | |
| var list = new List<CreditUnion>(); | |
| using (var reader = _database.ExecuteReader(command)) | |
| //turn Read into a generator... e.i unfold |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static IEnumerable<System.Xml.Linq.XElement> ToXElement(this IEnumerable<string> source, string tag = "Value") | |
| { | |
| return source.Select(s => new System.Xml.Linq.XElement(tag, s)); | |
| } | |
| public static IEnumerable<string> ToStrings(this System.Xml.Linq.XElement source, string tag = "Value") | |
| { | |
| return source.Elements("Value").Select(e => (string)e); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static IEnumerable<T> NullToEmpty<T>(this IEnumerable<T> source) | |
| { | |
| if (source==null) | |
| return new T[]{}; | |
| return source; | |
| } |
OlderNewer