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
string name = "420"; | |
var prefix = "0"; | |
prefix += new string('0', 10 - name.Length - 1); | |
Console.WriteLine(zeros+name); | |
Console.WriteLine((zeros+name).Length); |
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
// You need to install 'Microsoft.Web.Xdt' from nuget ==> Install-Package Microsoft.Web.Xdt | |
using System; | |
using System.Reflection; | |
using Microsoft.Web.XmlTransform; | |
namespace ConfigTransformer | |
{ | |
internal class Program | |
{ | |
private enum ExitCode : int |
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
sqlcmd -E -S "(localdb)\v11.0" -q "BACKUP DATABASE <DBNAME> TO DISK='<DRIVE>:\<FOLDER_PATH>\<BACKUP_FILE_NAME>.bak'" |
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
DECLARE BULKnvarchar nvarchar(max) | |
SELECT CAST('<data><![CDATA[' + @BULKnvarchar + ']]></data>' as xml) | |
-- use tools like 'http://coderstoolbox.net/string/#!encoding=xml&action=decode&charset=us_ascii' this | |
-- to decode the xml inside data element |
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
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 |
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
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 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
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 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
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 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
//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 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
//@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""/>"); |
NewerOlder