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
| private static string Rot13(string inputText) | |
| { | |
| return new string(inputText.Select(c => | |
| { | |
| var lower = Char.ToLower(c); | |
| if (lower >= 'a' && lower <= 'z' && lower > 'm') return (char)(c - 13); | |
| if (lower >= 'a' && lower <= 'z') return (char)(c + 13); | |
| return c; | |
| }).ToArray()); | |
| } |
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
| SELECT | |
| up.UserId | |
| ,XOR(up.Flags) | |
| FROM | |
| UserPermissions up | |
| GROUP BY | |
| up.UserId |
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 class ClientGroup | |
| { | |
| private List<Client> _clients = new List<Client>(); | |
| private void Add(Client oClient) { | |
| _clients.Add(oClient); | |
| } | |
| public void Add(string sMessyString){ | |
| this.Add(Client.ReturnClientObjectFromStringAfterConvert(sMessyString)); | |
| } |
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
| $svnUncommited = (git svn find-rev HEAD) -eq $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
| Action<int> gfa = k => { }; | |
| var il = gfa.Method.GetMethodBody().GetILAsByteArray().Where(b => b != OpCodes.Nop.Value).ToArray(); | |
| if (il.Length == 0 || (il.Length == 1 && il[0] == OpCodes.Ret.Value)) | |
| { | |
| Debug.WriteLine("Empty!"); | |
| } | |
| else | |
| { | |
| Debug.WriteLine("Not empty!"); | |
| } |
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
| NSNumber* __strong* numbers[] = { | |
| &major, &minor, &revision, &build | |
| }; |
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
| SET DATEFIRST 1; | |
| WITH [week]([date]) AS | |
| ( | |
| SELECT | |
| DATEADD(week, DATEDIFF(week, 0, GETDATE()), 0) | |
| UNION ALL | |
| SELECT | |
| [date]+1 FROM [week] | |
| WHERE | |
| DATEPART(dw, [date]+1) <= 5 |
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
| //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); |
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
| [Test] | |
| public void ShouldHandleAspNet4Rendering() | |
| { | |
| var text = string.Format("Hello World"); | |
| multiline.Text = text; | |
| doPostBack.Click(); | |
| Assert.AreEqual(text, multiline.Text); | |
| } |
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
| [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)) |