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 locale = "en-GB"; | |
| //IE | |
| if ((<any>(navigator)).browserLanguage) { | |
| locale = (<any>navigator).browserLanguage; | |
| } | |
| //All other vendors | |
| else if (navigator.language) { | |
| locale = (<any>navigator).language; | |
| } |
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
| conda create --name tensorflow python=3.5 | |
| activate tensorflow | |
| conda install jupyter | |
| conda install scipy | |
| conda install spyder | |
| conda install pip | |
| pip install tensorflow | |
| pip install pyyaml h5py | |
| pip install keras | |
| pip install opencv-python |
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 string strip(string str) | |
| { | |
| char[] arr = str.ToCharArray(); | |
| arr = Array.FindAll<char>(arr, (c => (char.IsLetter(c)))); | |
| str = new string(arr); | |
| return str.ToLowerInvariant(); | |
| } |
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 void WaitFileReady(string fileName) | |
| { | |
| while (true) | |
| { | |
| try | |
| { | |
| using (Stream stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) | |
| { | |
| if (stream != 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 getParameterByName(name, url) { | |
| if (!url) url = window.location.href; | |
| name = name.replace(/[\[\]]/g, "\\$&"); | |
| var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | |
| results = regex.exec(url); | |
| if (!results) return null; | |
| if (!results[2]) return ''; | |
| return decodeURIComponent(results[2].replace(/\+/g, " ")); | |
| } |
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 cancellationTokenSource = new CancellationTokenSource(); | |
| var cancellationToken = cancellationTokenSource.Token; | |
| Task.Delay(2000).ContinueWith(async (t) => | |
| { | |
| //Do stuff | |
| }, cancellationToken); |
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 InMemoryCache : ICacheService | |
| { | |
| public T Get<T>(string cacheID, TimeSpan duration, Func<T> getItemCallback) where T : class | |
| { | |
| T item = HttpRuntime.Cache.Get(cacheID) as T; | |
| if (item == null) | |
| { | |
| item = getItemCallback(); | |
| HttpContext.Current.Cache.Insert(cacheID, item, null, System.Web.Caching.Cache.NoAbsoluteExpiration, duration); | |
| } |
NewerOlder