This file contains 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 System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
namespace Utilities | |
{ | |
// Credit http://www.technofattie.com/2011/10/05/recursive-validation-using-dataannotations.html | |
// Usage | |
// |
This file contains 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 System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace Notifications | |
{ |
This file contains 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 ExtensionMethods | |
{ | |
public static List<List<T>> Split<T>(this IEnumerable<T> collection, int size) | |
{ | |
var chunks = new List<List<T>>(); | |
var count = 0; | |
var temp = new List<T>(); | |
foreach (var element in collection) | |
{ |
This file contains 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
namespace ExtensionMethods | |
{ | |
public static class ExtensionMethods | |
{ | |
public static void InvokeIfRequired<T>(this T obj, Action<T> action) where T : Control | |
{ | |
if (obj.InvokeRequired) | |
{ | |
obj.Invoke(new Action(() => action(obj))); | |
} |
This file contains 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
var shake = (function () { | |
var shake = {}, | |
watchId = null, | |
options = { frequency: 300 }, | |
previousAcceleration = { x: null, y: null, z: null }, | |
shakeCallBack = null; | |
// Start watching the accelerometer for a shake gesture | |
shake.startWatch = function (onShake) { | |
if (onShake) { |