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 class Retrier<TResult> | |
{ | |
/// <summary> | |
/// Retry to perform an operation/function | |
/// </summary> | |
/// <param name="func">Function to retry</param> | |
/// <param name="maxRetries">Maximum retires</param> | |
/// <param name="delayInMilliseconds">Delay on millies, 0 by default</param> | |
/// <returns>Result of the Function</returns> | |
public TResult TryBool(Func<TResult> func, int maxRetries, int delayInMilliseconds = 0) |
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 CSVHelper | |
{ | |
/// <summary> | |
/// Usage: | |
/// CSVHelper.ToCsv( | |
/// ",", | |
/// resultSet, | |
/// new List<KeyValuePair<string, string>> | |
/// { | |
/// new KeyValuePair<string,string>("caf_no", "'") |
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 class DataRepository<T> : IDataRepository<T> | |
where T : class, new() | |
{ | |
private DbContext context; | |
Logger log = new Logger(); | |
public DataRepository() | |
{ | |
} |
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
S2.define('select2/data/remoteQuery', [ | |
'./array', | |
'../utils', | |
'jquery' | |
], function (ArrayAdapter, Utils, $) { | |
function RemoteQueryAdapter($element, options) { | |
this.ajaxOptions = this._applyDefaults(options.get('remoteQuery')); | |
if (this.ajaxOptions.processResults != null) { | |
this.processResults = this.ajaxOptions.processResults; |
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
//@Html.ScriptsBundle("~/bundles/ng-modules", "~/Scripts/vendor/ng/modules", true) | |
public static class DynamicBundles | |
{ | |
public static IHtmlString StylesBundle(this HtmlHelper helper, string virtualPath, params string[] additionalPaths) | |
{ | |
if (BundleTable.Bundles.GetBundleFor(virtualPath) == null) | |
{ | |
BundleTable.Bundles.Add(new StyleBundle(virtualPath).Include(additionalPaths)); | |
} | |
return MvcHtmlString.Create(@"<link href=""" + HttpUtility.HtmlAttributeEncode(BundleTable.Bundles.ResolveBundleUrl(virtualPath)) + @""" rel=""stylesheet""/>"); |
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
//Include following js files | |
//"/scripts/react/react.js", | |
//"/scripts/react/react-dom.js", | |
//"/scripts/react/ReactRouter.js", | |
//"/scripts/Flux/Flux.js", | |
//"/scripts/EventEmitter/EventEmitter.js", | |
/// <reference path="scripts/react/react.js" /> | |
/// <reference path="scripts/react/react-dom.js" /> | |
/// <reference path="scripts/react/ReactRouter.js" /> |
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
XmlWriterSettings setting = new XmlWriterSettings(); | |
setting.ConformanceLevel = ConformanceLevel.Auto; | |
StringBuilder builder = new StringBuilder(); | |
using (XmlWriter writer = XmlWriter.Create(builder, setting)) | |
{ | |
writer.WriteStartElement("Users"); | |
foreach (var user in users) | |
{ | |
writer.WriteStartElement("User"); |
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
RestClient restClient = new RestClient(@"http://ia.media-imdb.com/images/M/MV5BMjM5OTQ1MTY5Nl5BMl5BanBnXkFtZTgwMjM3NzMxODE@._V1_SX300.jpg"); | |
var fileBytes = restClient.DownloadData(new RestRequest("#", Method.GET)); | |
File.WriteAllBytes(Path.Combine(directory, "poster-got.jpg"), fileBytes); |
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
vlc "{video path from which you want to exctract photos}" --video-filter=scene --vout=dummy --start-time=1 --scene-ratio=15 --scene-prefix=VTS_01_4-img- --scene-path="{folder path where you want to exctract photos}" vlc://quit |
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
CREATE TABLE #A (ID int Identity(1,1), fn varchar(10)) | |
DECLARE @output TABLE (id int) | |
Insert into #A (fn) | |
OUTPUT inserted.ID INTO @output | |
values ('1'), ('2'), ('3') | |
select * from @output |
OlderNewer