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
// App.js | |
import React, { Component } from "react"; | |
import Images from "./images"; | |
class App extends Component { | |
state = { | |
images: [ | |
"https://loremflickr.com/320/240?random=1", | |
"https://loremflickr.com/320/240?random=2", | |
"https://loremflickr.com/320/240?random=3" |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<startup> | |
<!-- supported items--> | |
</startup> | |
<system.diagnostics> | |
<sources> | |
<source name="DefaultSource" switchName="DefaultSwitch"> | |
<listeners> | |
<add name="EventLog"/> |
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
private static string CreateXml(object model) | |
{ | |
var xmlDoc = new XmlDocument(); | |
var xmlSerializer = new XmlSerializer(model.GetType()); | |
using (var xmlStream = new MemoryStream()) | |
{ | |
xmlSerializer.Serialize(xmlStream, model); | |
xmlStream.Position = 0; | |
xmlDoc.Load(xmlStream); | |
return xmlDoc.InnerXml; |
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
-- Source: https://blogs.msdn.microsoft.com/appfabricannounce/2010/07/01/finding-circular-foreign-key-references/ | |
SET NOCOUNT ON | |
-- WWB: Create a Temp Table Of All Relationship To Improve Overall Performance | |
CREATE TABLE #TableRelationships (FK_Schema nvarchar(max), FK_Table nvarchar(max), | |
PK_Schema nvarchar(max), PK_Table nvarchar(max)) | |
-- WWB: Create a List Of All Tables To Check | |
CREATE TABLE #TableList ([Schema] nvarchar(max), [Table] nvarchar(max)) |
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
_.object( | |
_.map(["One", "Two", "Three"], function(value, key) { | |
return [value, value]; | |
}) | |
); |
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
Action<string> Print = item => Console.WriteLine(item); | |
// void Print(string item) => Console.WriteLine(item); // To local function | |
var items = new List<string> { "Apple", "Mango", "Banana" }; | |
items.ForEach(Print); | |
Predicate<string> Predicate = item => item.Length > 5; | |
// bool Predicate(string item) => item.Length > 5; // To local function | |
var result = items.FindAll(Predicate); | |
result.ForEach(Print); |
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] Generate a private key and a certificate | |
Ref: https://web.archive.org/web/20120203022122/http://www.silassewell.com/blog/2010/06/03/node-js-https-ssl-server-example/ | |
openssl genrsa -out privatekey.pem 1024 | |
openssl req -new -key privatekey.pem -out certrequest.csr | |
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem | |
[2] Convert PEM to DER | |
Ref: https://www.sslshopper.com/ssl-converter.html |
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
/* | |
$ npm init | |
$ npm install express | |
$ touch app.js | |
$ node app.js | |
*/ | |
var express = require("express"), | |
fs = require("fs"), | |
app = express(); |
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
Ref: https://softwareengineering.stackexchange.com/questions/270265/what-is-the-best-way-to-structure-and-name-files-which-contain-generic-classes-w | |
MyGenericClass<T1> | |
MyGenericClass<T1, T2> | |
MyGenericClass<T1, T2, T3> | |
TO | |
MyGenericClass`1.cs | |
MyGenericClass`2.cs |
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
Ref: https://www.troyhunt.com/shhh-dont-let-your-response-headers/ | |
Not all headers are created equal and the way we turn them off within the Microsoft stack differs. Let’s recap on the ones we saw earlier on: | |
Server: The web server software being run by the site. Typical examples include “Microsoft-IIS/7.5”, “nginx/1.0.11” and “Apache”. | |
X-Powered-By: The collection (there can be multiple) of application frameworks being run by the site. Typical examples include: “ASP.NET”, “PHP/5.2.17” and “UrlRewriter.NET 2.0.0”. | |
X-AspNet-Version: Obviously an ASP.NET only header, typical examples include “2.0.50727”, “4.0.30319” and “1.1.4322”. | |
X-AspNetMvc-Version: Again, you’ll only see this in the ASP.NET stack and typical examples include “3.0”, “2.0” and “1.0”. |
OlderNewer