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 CacheHelper | |
| { | |
| public static string GetCachedResult(string key, Func<string> handle, int espiration = 86400) | |
| { | |
| var cache = HttpContext.Current.Cache; | |
| var response = cache.Get(key); | |
| if (response == null) | |
| { | |
| response = handle(); |
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 HumanNameGenerator | |
| { | |
| public enum Gender | |
| { | |
| Unknown = 0, | |
| Male = 1, | |
| Female = 2 | |
| } | |
| private static readonly Random Rand = new Random((int)DateTime.Now.Ticks); |
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 System.Runtime.InteropServices; | |
| namespace eConduct.Extensions | |
| { | |
| public static class GuidGenerator | |
| { | |
| [DllImport("rpcrt4.dll", SetLastError = true)] | |
| private static extern int UuidCreateSequential(out Guid guid); |
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 interface IUUIDGenerator | |
| { | |
| string Generate(ContentBase content); | |
| } | |
| public class GuidUIIDGenerator : IUUIDGenerator | |
| { | |
| [DllImport("rpcrt4.dll", SetLastError = true)] | |
| private static extern int UuidCreateSequential(out Guid guid); |
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
| if (!String.prototype.toUrl) { | |
| String.prototype.toUrl = function(o) { | |
| var r = this.replace(/\{([^{}]*)\}/g,function (a, b) { | |
| var r = o[b]; | |
| delete o[b]; | |
| return typeof r === 'string' || typeof r === 'number' ? r : a; | |
| } | |
| ), p = []; | |
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
| // paste it in your browsers console while surfing on facebook and you will like all things | |
| (function (){ | |
| var d = [], | |
| i = 0, | |
| l = 0, | |
| li = setInterval(function() { | |
| if (i < l) { | |
| console.log('like ' + i + ' out of ' + l); |
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 EnumerableExtensions | |
| { | |
| public static IEnumerable<IEnumerable<TSource>> SplitWithRest<TSource>(this IEnumerable<TSource> source, params Func<TSource, bool>[] predicates) | |
| { | |
| var taken = new List<TSource>(); | |
| for (int i = 0, l = predicates.Length; i < l; i++) | |
| { | |
| var take = source.Where(predicates[i]); | |
| taken.AddRange(take); |
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
Show hidden characters
| { | |
| "auto_complete": true, | |
| "auto_complete_commit_on_tab": false, | |
| "auto_complete_with_fields": true, | |
| "bold_folder_labels": true, | |
| "caret_style": "phase", | |
| "detect_indentation": true, | |
| "draw_white_space": "all", | |
| "ensure_newline_at_eof_on_save": true, | |
| "folder_exclude_patterns": |
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 DependencyController : Controller | |
| { | |
| public ActionResult Index(string repositoryName, string assembyName, string typeFullName) | |
| { | |
| if (!String.IsNullOrWhiteSpace(assembyName) && | |
| !String.IsNullOrWhiteSpace(typeFullName)) | |
| { | |
| var assembly = Assembly.Load(assembyName); | |
| if (assembly != 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
| (function(app, $) { | |
| app.directive('fooBar', function($timeout) { | |
| return { | |
| link: function(scope, elm, attrs) { | |
| elm.on('public.action', function(e) { | |
| // do stuff, call it by $('#elm').trigger('public.action'); | |
| }); |
OlderNewer