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
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
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
$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
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
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
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
public static int DivRem(int a, int b, out int result) | |
{ | |
result = a % b; | |
return a / 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
private static void ChangeToReturnFalse(MethodInfo methodInfo) | |
{ | |
var intPtrConstructor = typeof(IntPtr).GetConstructor(new[] { typeof(void*) }); | |
var method = new DynamicMethod("ChangeToReturnFalse", typeof(IntPtr), Type.EmptyTypes, typeof(ServiceLocationModule)); | |
var generator = method.GetILGenerator(); | |
generator.Emit(OpCodes.Ldftn, methodInfo); | |
generator.Emit(OpCodes.Newobj, intPtrConstructor); | |
generator.Emit(OpCodes.Ret); | |
var addressFunctor = (Func<IntPtr>)method.CreateDelegate(typeof(Func<IntPtr>)); | |
var address = addressFunctor(); |
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
open FSharp.Charting | |
open System | |
type ChartApplicationContext() as this = | |
inherit System.Windows.Forms.ApplicationContext() | |
do | |
let handler = new ConsoleCancelEventHandler(fun o e -> this.ExitThread()) | |
Console.CancelKeyPress.AddHandler(handler) | |