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
| var Fiber = require('fibers'); | |
| var decrement = function(input) { | |
| var fiber = Fiber.current; | |
| setTimeout(function () { | |
| console.log('decrement'); | |
| fiber.run(--input); | |
| }, 1000); |
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
| /* USE WITH NAMESPACING */ | |
| /* javascript reusable functions */ | |
| var lib = { | |
| /* add <option> for each item in json object */ | |
| /* json should be key value pair type */ | |
| /* var obj = { | |
| "flammable": "inflammable", | |
| "duh": "no duh" | |
| }; | |
| */ |
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> | |
| /// Utilties for reflection | |
| /// </summary> | |
| public static class ReflectionUtils | |
| { | |
| /// <summary> | |
| /// Get all the fields of a class | |
| /// </summary> | |
| /// <param name="type">Type object of that class</param> | |
| /// <returns></returns> |
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> | |
| /// Helpful methods to handle the <see cref="System.Drawing.Icon"/> stuff. | |
| /// </summary> | |
| public class IconHelper : IDisposable | |
| { | |
| [DllImport("user32.dll", SetLastError = true)] | |
| static extern int DestroyIcon(IntPtr hIcon); | |
| [DllImport("gdi32.dll")] | |
| static extern bool DeleteObject(IntPtr hObject); |
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> | |
| /// Use this method to enable/disable all items in a ribbon page. | |
| /// </summary> | |
| public static void ChangeRibbonPageItemsEnabledState(RibbonPage page, bool enabled) | |
| { | |
| foreach (RibbonPageGroup rpg in page.Collection) { | |
| foreach (BarItemLink itemLink in rpg.ItemLinks) | |
| { | |
| itemLink.Item.Enabled = enabled; | |
| } |
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
| protected void SafeBeginInvoke(Delegate method) | |
| { | |
| if (IsDisposed || Disposing) return; | |
| if (IsHandleCreated) | |
| { | |
| BeginInvoke(method); | |
| } | |
| } | |
| protected void SafeInvoke(Delegate method) |
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 EventArgs<T> : EventArgs | |
| { | |
| public EventArgs(T value) | |
| { | |
| this.value = value; | |
| } | |
| private readonly T value; | |
| public T Value |
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
| internal class Async | |
| { | |
| //Action = for void methods. | |
| public delegate void Action(); | |
| public delegate void Action<T>(T t); | |
| public delegate void Action<T, U>(T t, U u); | |
| public delegate void Action<T, U, V>(T t, U u, V v); | |
| //Func = for methods with some return type. | |
| public delegate TResult Func<TResult>(); |
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> | |
| /// Fires the specified event, and passes the input as a parameter. | |
| /// </summary> | |
| /// <typeparam name="T">Type of the input parameter.</typeparam> | |
| /// <param name="eventToFire">The event to fire.</param> | |
| /// <param name="sender">Object that triggered this event </param> | |
| /// <param name="input">Typeof EventArgsThe input.</param> | |
| /// <param name="eventName">Name of the event. Needed for error logging. </param> | |
| internal static void FireEvent<T>(Delegate eventToFire, object sender, T input, string eventName) | |
| { |