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
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Security.Cryptography; | |
public class PasswordCryptoServiceProvider : IDisposable | |
{ | |
protected const string Base58Chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; | |
private readonly SymmetricAlgorithm algorithm; |
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
"scripts": { | |
"ng": "ng", | |
"start": "ng serve --open", | |
"start-hmr": "ng serve --configuration hmr --source-map=false --hmr-warning=false", | |
"start-hmr-sourcemaps": "ng serve --configuration hmr --source-map=true --hmr-warning=false", | |
"build": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --aot --deploy-url=dist/ --output-hashing all --watch", | |
"build-watch": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --deploy-url=dist/ --output-hashing all --watch", | |
"build-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev --stats-json", | |
"build-prod": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --prod --aot --deploy-url=dist/", | |
"build-ci": "ng build --prod --aot --output-path=prod/dist --deploy-url=dist/", |
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
1.Create a cookie before writing the stream to Response. | |
2.Use JavaScript timer to check whether the value of cookie is set to true | |
3.If downloaded cookie is true, display a message that file download is successful and erase cookie | |
<script> | |
var timer; | |
function getCookie(name) { | |
var re = new RegExp(name + "=([^;]+)"); | |
var value = re.exec(document.cookie); | |
return (value != null) ? unescape(value[1]) : null; |
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
Pivot C# Array or DataTable: Convert a Column To a Row with LINQ | |
var data = new[] { | |
new { Product = "Product 1", Year = 2009, Sales = 1212 }, | |
new { Product = "Product 2", Year = 2009, Sales = 522 }, | |
new { Product = "Product 1", Year = 2010, Sales = 1337 }, | |
new { Product = "Product 2", Year = 2011, Sales = 711 }, | |
new { Product = "Product 2", Year = 2012, Sales = 2245 }, | |
new { Product = "Product 3", Year = 2012, Sales = 1000 } | |
}; |
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
select f.*, | |
count(*) over ( | |
partition by title, uk_release_date | |
) ct | |
from films f; | |
select * | |
from ( | |
select f.*, | |
count(*) over ( |
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
int y = Nullable.Compare<DateTime>(DateTime.UtcNow, x); | |
if y=-1 means x is greater | |
if y=1 means x is lesser | |
if y=0 means equal |
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
<add key="aspnet:MaxJsonDeserializerMembers" value="2147483647" /> | |
Response.Write(new ScriptingJsonSerializationSection().MaxJsonLength); |